GetPlayerName(playerid,pname,sizeof(pname));
format(string,sizeof(string),"* %s(%d) vient de rejoindre {KFX} Survivants vs Zombies.",pname,playerid);
SendClientMessageToAll(COLOR_DEADCONNECT,string);
Administrator KillerDVX has joined the server
Hi all,
I wanna to make a script that defines if an Administrator is connected I have made one for players : PHP Code:
PHP Code:
|
if(PlayerInfo[i][pAdmin] >= 1) { format(string,sizeof(string),"* Administrator KillerDVX has joined the server"); SendClientMessageToAll(COLOR_DEADCONNECT,string); }
if (PlayerInfo[playerid][pAdmin] > 0) { if(PlayerInfo[playerid][pAdmin] == 1) { SendClientMessageEx(playerid, COLOR_WHITE,"You are logged in as a Server Moderator."); } else { format(string2, sizeof(string2), "You are logged in as a Level %d Admin.",PlayerInfo[playerid][pAdmin]); SendClientMessageEx(playerid, COLOR_WHITE,string2); } if(PlayerInfo[playerid][pAdmin] == 1) { format( string2, sizeof( string2 ), "%s has logged in as a Server Moderator.", GetPlayerNameEx( playerid )); } else { format( string2, sizeof( string2 ), "%s has logged in as a Level %d Admin.", GetPlayerNameEx( playerid ), PlayerInfo[playerid][pAdmin] ); } foreach(Player, i) { if( PlayerInfo[i][pAdmin] >= 1337 ) { if(PlayerInfo[i][pAdmin] >= PlayerInfo[playerid][pAdmin]) SendClientMessageEx(i, COLOR_WHITE, string2); } } }
public OnPlayerConnect(playerid) { new astr[120], aname[MAX_PLAYER_NAME]; if(pInfo[playerid][pAdmin] > 0) // Change with own var { GetPlayerName(playerid,aname,sizeof(aname)); format(astr, sizeof(astr), "* Administrator %s has joined the server", aname); SendClientMessageToAll(COLOR_DEADCONNECT, astr); } return 1; }
Code:
public OnPlayerConnect(playerid) { new astr[120], aname[MAX_PLAYER_NAME]; if(pInfo[playerid][pAdmin] > 0) // Change with own var { GetPlayerName(playerid,aname,sizeof(aname)); format(astr, sizeof(astr), "* Administrator %s has joined the server", aname); SendClientMessageToAll(COLOR_DEADCONNECT, astr); } return 1; } |
have you tried:
Code:
if(PlayerInfo[i][pAdmin] >= 1) { format(string,sizeof(string),"* Administrator KillerDVX has joined the server"); SendClientMessageToAll(COLOR_DEADCONNECT,string); } Code:
if (PlayerInfo[playerid][pAdmin] > 0) { if(PlayerInfo[playerid][pAdmin] == 1) { SendClientMessageEx(playerid, COLOR_WHITE,"You are logged in as a Server Moderator."); } else { format(string2, sizeof(string2), "You are logged in as a Level %d Admin.",PlayerInfo[playerid][pAdmin]); SendClientMessageEx(playerid, COLOR_WHITE,string2); } if(PlayerInfo[playerid][pAdmin] == 1) { format( string2, sizeof( string2 ), "%s has logged in as a Server Moderator.", GetPlayerNameEx( playerid )); } else { format( string2, sizeof( string2 ), "%s has logged in as a Level %d Admin.", GetPlayerNameEx( playerid ), PlayerInfo[playerid][pAdmin] ); } foreach(Player, i) { if( PlayerInfo[i][pAdmin] >= 1337 ) { if(PlayerInfo[i][pAdmin] >= PlayerInfo[playerid][pAdmin]) SendClientMessageEx(i, COLOR_WHITE, string2); } } } |
public OnPlayerConnect(playerid)
{
new AdminName[MAX_PLAYER_NAME],message[128];
GetPlayerName(playerid,AdminName,sizeof(AdminName));
if(PlayerInfo[playerid][pAdmin] >= 1) // If your var is e.g. pAdministrator change pAdmin to pAdministrator...
{
format(message,128,"%s[%d] joined the game.",AdminName,playerid); // e.g. "Mirko[1] joined the game". %s means string,%d integer.
SendClientMessageToAll(-1,message); // Sending message to all.
}
}
error 017: undefined symbol "pInfo"
error 028: invalid subscript (not an array or too many subscripts): "pInfo"
have you tried:
Code:
if(PlayerInfo[i][pAdmin] >= 1) { format(string,sizeof(string),"* Administrator KillerDVX has joined the server"); SendClientMessageToAll(COLOR_DEADCONNECT,string); } Code:
if (PlayerInfo[playerid][pAdmin] > 0) { if(PlayerInfo[playerid][pAdmin] == 1) { SendClientMessageEx(playerid, COLOR_WHITE,"You are logged in as a Server Moderator."); } else { format(string2, sizeof(string2), "You are logged in as a Level %d Admin.",PlayerInfo[playerid][pAdmin]); SendClientMessageEx(playerid, COLOR_WHITE,string2); } if(PlayerInfo[playerid][pAdmin] == 1) { format( string2, sizeof( string2 ), "%s has logged in as a Server Moderator.", GetPlayerNameEx( playerid )); } else { format( string2, sizeof( string2 ), "%s has logged in as a Level %d Admin.", GetPlayerNameEx( playerid ), PlayerInfo[playerid][pAdmin] ); } foreach(Player, i) { if( PlayerInfo[i][pAdmin] >= 1337 ) { if(PlayerInfo[i][pAdmin] >= PlayerInfo[playerid][pAdmin]) SendClientMessageEx(i, COLOR_WHITE, string2); } } } |
if(code to check if the player is an admin)
{
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "* %s(%d) vient de rejoindre {KFX} Survivants vs Zombies.", pname, playerid);
SendClientMessageToAll(COLOR_DEADCONNECT, string);
}
else
{
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "* %s(%d) vient de rejoindre {KFX} Survivants vs Zombies.", pname, playerid);
SendClientMessageToAll(COLOR_DEADCONNECT, string);
}
PHP Code:
I tried enum pInfo { pAdmin, }; new PlayerInfo[MAX_PLAYERS][pInfo]; But it gives me : PHP Code:
|