16.06.2014, 22:36
I would like to know how can i make the below command work with a key & get the closest player
The key i would like to use is number 2 .
EDIT: I updated the command , and you should know that i haven't added a function that will check if the player is near another player .
The key i would like to use is number 2 .
pawn Код:
CMD:infect(playerid,params[])
{
if(gTeam[playerid] == TEAM_ZOMBIES)
{
new string[128];
new targetid;
new pName[MAX_PLAYER_NAME];
new tName[MAX_PLAYER_NAME];
if(!IsPlayerConnected(targetid)) return NOACCESS
if(sscanf(params,"u",targetid)) return xSCM"{FFA500}*{EEEEEE}Usage:/infect [playerid]");
GetPlayerName(playerid,pName,sizeof(pName));
GetPlayerName(targetid,tName,sizeof(tName));
format(string,sizeof(string),"{FFA500}*%s has infected %s and now he's a zombie",pName,tName);
SendClientMessageToAll(COLOR_WHITE,string);
gTeam[targetid] = TEAM_ZOMBIES;
SetPlayerColor(targetid,COLOR_ORANGE);
SetPlayerPos(targetid,-273.5326,1152.8778,20.7803);
SetPlayerHealth(targetid,100.0);
}
else xSCM"{FFA500}*{EEEEEE}You're not a zombie!");
return 1;
}