Hey folks been busy with my exams and i still am, i got some minutes after revising ma whole paper so got time to browse little and here it is VIP SYSTEM. First time for 0.3z R2 so its for GUPS
why? Because i see most of the new comers or still people is using it so i thought it would be better for that.Coding Time...
Define this on top:
#define VIP_FILE "/Vips/%s.ini"
Add this on the top:
enum playerInfo
{
Spawnedp,
brb,
back,
muted,
Password[MAX_PASS_SIZE+1],
Logged,
FalseLogins,
prank,
Level,
VLevel
}
enum vipinfo
{
IsVip
}
enum commandcount
{
healthc,
armourc
}
I am using many enums to to make less confusion... if you are skilled enough you can use these all in 1 enum...
You already have the pinfo defined so just add this under that
new vinfo[MAX_PLAYERS][vipinfo];
Very Important and Careful stepGo on the Register command and add these lines with the other Dini_ Lines.
dini_Create(file3);
dini_Set( file3, "VIP", "0" );
Go to your /c login command and search for the
if(strcmp(getpass(tmp), pass_confirm, true) == 0)
{
Add this on the top section of that.
vlevel = dini_Int( file3, "VIP" );
pInfo[ playerid ][ VLevel ] = vlevel;
Add this under THIS
if(strcmp(getpass(tmp), pass_confirm, true) == 0)
{
REMBER TO ADD THIS UNDER THAT LINE AND THE OTHER UP ON THAT LINE ( im saying again and again because you will end up owned if you do something wrong because this is TOTALLY tested and works fine so if you guys get errors then its not scripts fault )
if(dini_Exists(file3)) return SendclientMessage(playerid, RED, "[Server] VIP Account Loaded");
{
vlevel = GetVL(gPlayers[ playerid ] );
pInfo[playerid][VLevel] = vlevel;
vinfo[playerid][IsVip] = 1;
format(szMsg,128,"[VIP] %s Is Now Logged-In and Connected",gPlayers[playerid]);
SendClientMessageToAll(COLOR_YELLOW,szMsg);
format( szMsg, sizeof( szMsg ), "VIP Level %d ( %s )",vlevel, Vlevels( vlevel ) );
SendClientMessage(playerid,RED,szMsg);
}
Add these commands carefully//=========================================[ VIP FUNCTIONS ]=============================================================
else if ( strcmp( cmd, "vgoto", true ) == 0 )
{
tmp = strtok( cmdtext, idx );
if ( !strlen( tmp ) ) SendClientMessage( playerid, COLOR_GREY, "[Server Error] /c vgoto [Nick/ID]" );
else if( pInfo[playerid][VLevel] < 2 ) return SendClientMessage(playerid,GREEN,"[Server Protection] You Are Not VIP");
else
{
new plr = FindPlayerIDFromString( tmp );
if ( plr == INACTIVE_PLAYER_ID ) SendClientMessage( playerid, COLOR_GREEN, "[Server Error] Unknown player" );
else
{
GetPlayerPos( plr, x, y, z );
SetPlayerPos( playerid, x, y + 1.0, z, 0, 0 );
format( szMsg, sizeof( szMsg ), "[VIP COMMAND] Teleportation [ [VIP] %s ] to:[ %s ]", gPlayers[ playerid ], gPlayers[ plr ] );
SendClientMessageToAll( COLOR_GREEN, szMsg );
}
}
return 1;
}
else if ( strcmp( cmd, "vsay", true ) == 0 )
{
tmp = strtok( cmdtext, idx );
if ( !strlen( tmp ) ) SendClientMessage( playerid, COLOR_GREY, "[Server Error] /c vsay [Text]" );
else if( pInfo[playerid][VLevel] < 3 ) return SendClientMessage(playerid,GREEN,"[Server Protection] You Are Not VIP");
else
{
GetPlayerTeam(playerid);
if(GetPlayerTeam(playerid) == 1)
{
format( szMsg, sizeof( szMsg ), "[VIP] %s: %s ", gPlayers[ playerid ], cmdtext[4] );
SendClientMessageToAll( ORANGE, szMsg );
}
else if(GetPlayerTeam(playerid) == 2)
{
format( szMsg, sizeof( szMsg ), "[VIP] %s: %s ", gPlayers[ playerid ], cmdtext[4] );
SendClientMessageToAll( PURPLEE, szMsg );
}
}
return 1;
}
else if (strcmp(cmd, "donate", true) == 0 )
{
SendClientMessage(playerid,BLUE,"=================>[V.I.P]<=============== ");
SendClientMessage(playerid,BLUE,"Lvl 1 [Bronze], Lvl2 [Silver], Lvl3 [GOLD], Lvl4 [PREMIUM]");
SendClientMessage(playerid,BLUE,"Check /c vip for level informations");
return 1;
}
else if (strcmp(cmd, "buy", true) == 0 || strcmp(cmd,"shop", true) == 0)
{
SendClientMessage(playerid,BLUE,"=================>[V.I.P]<=============== ");
SendClientMessage(playerid,BLUE,"/c vwep [ any weapon ]");
SendClientMessage(playerid,BLUE,"Heavy Weapons, Money on spawn including to level");
return 1;
}
else if (strcmp(cmd, "vip", true) == 0)
{
SendClientMessage(playerid,BLUE,"[/c] level1 Upto level4. Use number for the current level cmds" );
return 1;
}
else if (strcmp(cmd, "level1", true) == 0)
{
SendClientMessage(playerid,BLUE,"[/c] vwep + 200$ on each spawn" );
return 1;
}
else if (strcmp(cmd, "level2", true) == 0)
{
SendClientMessage(playerid,BLUE,"[/c] vwep, vgoto+ 500$ on each spawn" );
return 1;
}
else if (strcmp(cmd, "level3", true) == 0)
{
SendClientMessage(playerid,BLUE,"[/c] vwep, vgoto, vsay, armour + 1500$ on each spawn" );
return 1;
}
else if (strcmp(cmd, "level4", true) == 0)
{
SendClientMessage(playerid,BLUE,"[/c] vwep, vgoto, vsay, health, armour + 10000$ on each spawn" );
return 1;
}
else if (strcmp(cmd, "vwep", true) == 0)
{
if(pInfo[playerid][VLevel] == 0)
{
SendClientMessage(playerid,RED,"[Server Protection] You Are not VIP " );
}
else
{
tmp = strtok( cmdtext, idx );
new wep[256];
wep[1] = FindWepIDFromString ( tmp );
GivePlayerWeapon(playerid,wep[1], 9999);
}
}
else if (strcmp(cmd, "health", true) == 0)
{
if(pInfo[playerid][VLevel] == 0)
{
SendClientMessage(playerid,RED,"[Server Protection] You Are not VIP " );
}
else if(pInfo[playerid][VLevel] < 3)
{
SendClientMessage(playerid,RED,"[Server Protection] You Are not high enough VIP level" );
}
else
{
new Float:health;
if(cmdinfo[playerid][healthc] == 0)
{
cmdinfo[playerid][healthc] = 1;
GetPlayerHealth(playerid,health);
SetPlayerHealth(playerid,health+25);
format(szMsg,256,"V.I.P %s used vip cmd to get +50 health",gPlayers[playerid]);
SendClientMessageToAll(COLOR_YELLOW,szMsg);
return 0;
}
else if(cmdinfo[playerid][healthc] == 1)
{
cmdinfo[playerid][healthc] = 2;
GetPlayerHealth(playerid,health);
SetPlayerHealth(playerid,health+25);
format(szMsg,256,"V.I.P %s used vip cmd to get +50 health",gPlayers[playerid]);
SendClientMessageToAll(COLOR_YELLOW,szMsg);
return 0;
}
else if(cmdinfo[playerid][healthc] == 2)
{
cmdinfo[playerid][healthc] = 3;
GetPlayerHealth(playerid,health);
SetPlayerHealth(playerid,health+25);
format(szMsg,256,"V.I.P %s used vip cmd to get +50 health",gPlayers[playerid]);
SendClientMessageToAll(COLOR_YELLOW,szMsg);
return 0;
}
else if(cmdinfo[playerid][healthc] == 3)
{
SendClientMessage(playerid,BLUE,"[Server] VIP cmd Limit Exceeded! [ Max 3 At Each Spawn ]");
}
}
return 1;
}
else if (strcmp(cmd, "armour", true) == 0)
{
if(pInfo[playerid][VLevel] == 0)
{
SendClientMessage(playerid,RED,"[Server Protection] You Are not VIP " );
}
else if(pInfo[playerid][VLevel] < 3)
{
SendClientMessage(playerid,RED,"[Server Protection] You Are not high enough VIP level" );
}
else
{
new Float:armour;
if(cmdinfo[playerid][armourc] == 0)
{
cmdinfo[playerid][armourc] = 1;
GetPlayerArmour(playerid,armour);
SetPlayerArmour(playerid,armour+25);
format(szMsg,256,"V.I.P %s used vip cmd to get +25 armour",gPlayers[playerid]);
SendClientMessageToAll(COLOR_YELLOW,szMsg);
return 0;
}
else if(cmdinfo[playerid][armourc] == 1)
{
cmdinfo[playerid][armourc] = 2;
GetPlayerArmour(playerid,armour);
SetPlayerArmour(playerid,armour+25);
format(szMsg,256,"V.I.P %s used vip cmd to get +25 armour",gPlayers[playerid]);
SendClientMessageToAll(COLOR_YELLOW,szMsg);
return 0;
}
else if(cmdinfo[playerid][armourc] == 2)
{
cmdinfo[playerid][armourc] = 3;
GetPlayerArmour(playerid,armour);
SetPlayerArmour(playerid,armour+25);
format(szMsg,256,"V.I.P %s used vip cmd to get +25 armour",gPlayers[playerid]);
SendClientMessageToAll(COLOR_YELLOW,szMsg);
return 0;
}
else if(cmdinfo[playerid][armourc] == 3)
{
SendClientMessage(playerid,BLUE,"[Server] VIP cmd Limit Exceeded! [ Max 3 At Each Spawn ]");
}
}
return 1;
}
//===========================================[ VIP FUNCTIONS END ] ==========================================
Add this at OnPlayerSpawn
if(pInfo[playerid][VLevel] == 1)
{
new cash;
cash = GetPlayerMoney(playerid);
SetPlayerMoney(playerid,cash+200);
}
if(pInfo[playerid][VLevel] == 2)
{
new cash;
cash = GetPlayerMoney(playerid);
SetPlayerMoney(playerid,cash+500);
}
if(pInfo[playerid][VLevel] == 3)
{
new cash;
cash = GetPlayerMoney(playerid);
SetPlayerMoney(playerid,cash+1500);
}
if(pInfo[playerid][VLevel] == 4)
{
new cash;
cash = GetPlayerMoney(playerid);
SetPlayerMoney(playerid,cash+10000);
}
Add these 2 functions at top of
STOCKSpublic GetVL(player[])
{
new vl;
format( file3, sizeof( file3 ), VIP_FILE, player);
vl = dini_Int( file3, "VIP" );
return vl;
}
public Vlevels(vlevel)
{
new vl[ 30 ];
if (vlevel == 1 ) vl = "Bronze";
else if (vlevel == 2) vl = "Silver";
else if (vlevel == 3) vl = "Gold";
else if (vlevel == 4) vl = "PREMIUM";
return vl;
}
Finally Go to Scriptfiles > Create a new folder and name it Vips
BE CAREFUL WITH CAPITAL AND SMALL LETTERS TYPE IT THE WAY IT ISAfter registration you will get a file in Vips folder with players name and you can set him whatever level you want so 0 = normal, 1 = Bronze, 2 = Silver, 3 = Gold and 4 = Premium.To Set already registered player to VIP use this command:
else if ( strcmp( cmd, "Setvip", true ) == 0 )
{
new plr, tmp2[256];
tmp = strtok( cmdtext, idx ), tmp2 = strtok( cmdtext, idx ), plr = FindPlayerIDFromString( tmp );
if( !IsPlayerAdmin(playerid) ) return 0;
else if ( !strlen(tmp2) ) SendClientMessage( playerid, COLOR_RED, "[Server] /c makevip [Nick/ID] [Level]");
else if ( plr == INACTIVE_PLAYER_ID ) SendClientMessage( playerid, COLOR_RED, "Error: Unknown player" );
else
{
format( szMsg, sizeof( szMsg ), "[Admin] %s Has Promoted Player %s To VIP", gPlayers[ playerid ], gPlayers[ plr ]);
SendClientMessageToAll( COLOR_GREEN, szMsg );
format(file3, sizeof(file3), VIP_FILE, PlayerName(plr));
dini_Create(file3);
dini_Set( file3, "VIP", tmp2 );
}
return 1;
}
If you encounter problems i won't be able to help you ( Maybe ) because of exams and if you add it totally right it will definitely work.. Have fun
Credits would be appreciated