Making a command work with a key.
#5

Use:
pawn Код:
CMD:infect(playerid,params[])
{
    if(gTeam[playerid] != TEAM_ZOMBIES) return xSCM"{FFA500}*{EEEEEE}You're not a zombie!");
    new targetid;
    if(sscanf(params, "u", targetid)) return xSCM"{FFA500}*{EEEEEE}Usage:/infect [playerid]");
    if(targetid == INVALID_PLAYER_ID || !IsPlayerConnected(targetid) || targetid == playerid) return NOACCESS;
    if(gTeam[targetid] == TEAM_ZOMBIES) return xSCM"{FFA500}*{EEEEEE}They are already a zombie!");
    new string[100], pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    GetPlayerName(targetid, tName, sizeof(tName));
    format(string, sizeof(string), "{FFA500}*%s has infected %s and now they're 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);
    return 1;
}
With the Jeff's GetClosestPlayer and OnPlayerKeyStateChange. Take note that Jeff's GetClosestPlayer is suited to get a player within 2.0 units of 'playerid'.
Reply


Messages In This Thread
Making a command work with a key. - by Johnson_Brooks - 16.06.2014, 22:36
Respuesta: Making a command work with a key. - by Zume - 16.06.2014, 23:38
Re: Making a command work with a key. - by iFiras - 17.06.2014, 00:07
Re: Making a command work with a key. - by Jefff - 17.06.2014, 00:22
Re: Making a command work with a key. - by Threshold - 17.06.2014, 01:34
Re: Making a command work with a key. - by Johnson_Brooks - 17.06.2014, 22:29
Re: Making a command work with a key. - by Jefff - 17.06.2014, 22:38
Re: Making a command work with a key. - by Johnson_Brooks - 17.06.2014, 22:55
Re : Making a command work with a key. - by Chipardeur - 17.06.2014, 23:00

Forum Jump:


Users browsing this thread: 2 Guest(s)