04.04.2015, 08:59
Untested but should work
PHP код:
CMD:offcheck(playerid,params[])
{
new offnick[MAX_PLAYER_NAME];
if(sscanf(params,"s[128]",offnick)) return SendClientMessage(playerid, -1, "Usage: /offcheck [full name]");
if(IsPlayerConnected(GetPlayerIdFromName(offnick)) return SendClientMessage(playerid, -1, "You cannot use this command on online players.");
// Code
return 1;
}
stock GetPlayerIdFromName(playername[])
{
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new playername2[MAX_PLAYER_NAME];
GetPlayerName(i, playername2, sizeof(playername2));
if(strcmp(playername2, playername, true, strlen(playername)) == 0)
{
return i;
}
}
}
return INVALID_PLAYER_ID;
}