25.09.2012, 22:21
How can i add that VIP's have a [VIP] Tag before he Name? So i have define VIP:
Quote:
if(VIP[playerid] == 1) |
if(VIP[playerid] == 1) |
public OnGameModeInit() //or OnFilterScriptInit for Filterscripts
{
SetTimer("VIPCHECK", 5000, true);
return 1;
}
forward VIPCHECK();
public VIPCHECK()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new PLAYERSNAME[MAX_PLAYER_NAME];
GetPlayerName(i, PLAYERSNAME, MAX_PLAYER_NAME);
if(VIP[i] > 0)
{
SetPlayerColor(i, 0xFF0000FF); //Change 0xFF0000FF (Red) with whatever color you want your VIPs to be
if(strfind(PLAYERSNAME, "[VIP]", true) == -1 || strfind(PLAYERSNAME, "VIP_", true) == -1) //-1 because it was 'not found'
{
new newname[MAX_PLAYER_NAME];
if(strlen(PLAYERSNAME) >= 20)
{
format(newname, sizeof(newname),"VIP_%s",PLAYERSNAME);
}
else
{
format(newname,sizeof(newname),"[VIP]%s",PLAYERSNAME);
}
SetPlayerName(i, newname);
}
}
else
{
//SetPlayerColor(i, 0x00FF00FF); //Optional, but you can use this to set regular player's colours.
if(strfind(PLAYERSNAME,"[VIP]", true) != -1)
{
new found = strfind(PLAYERSNAME, "[VIP]", true);
strdel(PLAYERSNAME, found, found + 4);
SetPlayerName(i, PLAYERSNAME);
}
else if(strfind(PLAYERSNAME, "VIP_", true) != -1)
{
new found = strfind(PLAYERSNAME, "VIP_", true);
strdel(PLAYERSNAME, found, found + 3);
SetPlayerName(i, PLAYERSNAME);
}
}
}
}
return 1;
}