This commands work in all script whit register system only you need change the name of the folder in public getviplevel and setviplevel
[pawn]new MSN[256];[/pawn]
[pawn]//=========================Vip System for Vips players===========================================
public GetVipLevel(playerid)
{
format(MSN,256, USERS_FILE, gPlayers[playerid]);
new Vip; Vip = dini_Int(MSN,"Vip");
return Vip;
}
public SetVipLevel(playerid,Vip)
{
format(MSN,256, USERS_FILE, gPlayers[playerid]);
dini_IntSet(MSN,"Vip",Vip);
}
//==============================================================================[/pawn]
[pawn]public VipLevel(Vip)
{
new vip[256];
if (Vip == 0) vip = "Not is a Vip";
if (Vip == 1) vip = "Bronze Vip";
if (Vip == 2) vip = "Silver Vip";
if (Vip == 3) vip = "Gold Vip";
else if (Vip >= 4) vip = "Premium Vip";
return vip;
}[/pawn]
Need create a new value in configuration, commands, example setvip=10
[pawn] else if (strcmp(cmd, "setvip", true) == 0)
{
new level[256];
tmp = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp), level = strtok(cmdtext, idx);
if ( !IsAuthorized( playerid, cmd ) ) SendClientMessage( playerid, 0xF0182DFF, "Not Have Acces to use this command" );
if (!strlen(tmp)) SendClientMessage(playerid, 0xFFFF00AA,"[System]: /c SetVip [Name] [1/2/3/4]" );
else {
if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid, 0xF0182DFF,"[Error] - Unknown Player.");
else if (!IsNumeric(level)) SendClientMessage(playerid, 0xFFFF00AA,"[Error] -Invalid Vip Level.");
else {
format( szMsg, sizeof( szMsg ), "Admin %s give vip level to: %s, of: [%s].",gPlayers[playerid],gPlayers[plr],VipLevel(strval(level)));
SendClientMessageToAll( 0xFFFF00AA, szMsg);
SetVipLevel(plr,strval(level));
}
}
return 1;
}[/pawn]
In OnplayerSpawn put this
[pawn] format( szMsg, sizeof( szMsg ), " [%s] Is spawned Vip Level: [%s].",gPlayers[playerid],VipLevel(GetVipLevel(playerid)));
SendClientMessageToAll(0xFFFF00AA, szMsg );[/pawn]
And one idea to make a vip commands
[pawn] else if (strcmp(cmd, "jail", true) == 0) {
new razon[256];
tmp = strtok( cmdtext, idx ), razon = strtok( cmdtext, idx ), plr = FindPlayerIDFromString( tmp );
if ( !IsLoggedIn( playerid ) ) SendClientMessage(playerid, 0xF0182DFF, "Login in you account" );
else if ( !strlen(razon) ) SendClientMessage(playerid, 0xF0182DFF, "Write: /c jail [Nick/ID] [Reason]" );
else if ( plr == INACTIVE_PLAYER_ID ) SendClientMessage(playerid, 0xF0182DFF, "Error: Jugador desconocido" );
else
{
if(GetVipLevel(playerid)>= 1)
{
format( szMsg, sizeof( szMsg ), "[Vip %s] send to jail:[ %s ] Reason:[ %s ]", gPlayers[ playerid ], gPlayers[ plr ], cmdtext[ strlen( tmp ) +8 ] );
SendClientMessageToAll( 0xF0182DFF, szMsg );
SetPlayerPos(plr,393.5389,-505.2466,9.3956,0,0);
TogglePlayerControllable( plr, 0 );
ToggleWidescreenForPlayer(plr,1);
ToggleGreenScanlinesForPlayer(plr,1);
}
else SendClientMessage(playerid,ROJO,"Not is a vip");
}
return 1;
}[/pawn]
This is a real, nice and simple commands whit not errors
Take my idea, but give me thanks first