#7

pawn Код:
CMD:slap(playerid, params[])
{
    new Float:X, Float:Y, Float:Z, str[128], name[MAX_PLAYER_NAME];
    new Float:Health;
    GetPlayerHealth(playerid,Health);
    SetPlayerHealth(playerid,Health-25);
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerPos(playerid, X, Y, Z);
    format(str, sizeof(str), "%s was slapped by %s", name, name);
    if(sscanf(params, "u", playerid)) {
        return SendClientMessage(playerid, 0xFF0000AA, "Usage: /slap <playerid>");
    }
    if (!IsPlayerConnected(playerid)) {
      return SendClientMessage(playerid, COLOR_DARKRED, "[ERROR:] This ID is has not been found.");
    }
    else
    {
        PlayerPlaySound(playerid, 1190, X, Y, Z);
        SetPlayerPos(playerid, X, Y, Z+7);
        TogglePlayerControllable(playerid, true);
        SendClientMessageToAll(COLOR_DARKRED, str);
    }
    return 1;
}
If you look I added
pawn Код:
if (!IsPlayerConnected(playerid)) {
      return SendClientMessage(playerid, COLOR_DARKRED, "[ERROR:] This ID is has not been found.");
    }
But it don't work so I was wondering how I could do it.. Although this is just a test so..

EDIT: Okay I'll try that.

EDIT #2: Yes, Gar's code works but still I need it to check the if the player is connected.
Reply


Messages In This Thread
Hmm? - by Luis- - 29.11.2010, 15:45
Re: Hmm? - by MadeMan - 29.11.2010, 15:48
Re: Hmm? - by Luis- - 29.11.2010, 15:50
Re: Hmm? - by Luis- - 29.11.2010, 16:23
Re: Hmm? - by Scenario - 29.11.2010, 16:24
Re: Hmm? - by [03]Garsino - 29.11.2010, 16:27
Re: Hmm? - by Luis- - 29.11.2010, 16:27
Re: Hmm? - by Scenario - 29.11.2010, 16:33
Re: Hmm? - by [03]Garsino - 29.11.2010, 16:35
Re: Hmm? - by Luis- - 29.11.2010, 16:41

Forum Jump:


Users browsing this thread: 1 Guest(s)