Slap command returns an Unknown Command when player is not connected
#10

Try this, looks perfect to me. HOWEVER, not tested.
Also, "i" parameter is an integer and "u" parameter represents User (bot/player) ...
BTW, do not update your SA-MP server to R5 until Y_Less fixes the "u" parameter, meanwhile, stay with R4 or lower.
pawn Code:
YCMD:slap(playerid, params[], help) {
    #pragma unused help
    new targetid, Float:x, Float:y, Float:z, slap_string[62];
    if(!IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_ORANGE,"You are not a high enough level to use this command !");
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /slap [playerid]"); // "u" parameter is User (bot/player)
    if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ORANGE, "Player not connected");
    format(slap_string, sizeof(slap_string), "%s has slapped %s", GetPlayerNameEx(playerid), GetPlayerNameEx(targetid));
    SendClientMessageToAll(COLOR_ORANGE, string);
    GetPlayerPos(targetid, x, y, z);
    SetPlayerPos(targetid, x, y, z+15);
    return 1;
}

stock GetPlayerNameEx(playerid) {
    new PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    return PlayerName;
}
Reply


Messages In This Thread
Login Issue - by HydraX - 31.07.2011, 04:42
Re: Slap command returns an Unknown Command when player is not connected - by [HiC]TheKiller - 31.07.2011, 04:51
Re: Slap command returns an Unknown Command when player is not connected - by HydraX - 31.07.2011, 04:55
Re: Slap command returns an Unknown Command when player is not connected - by HydraX - 31.07.2011, 05:00
Re: Slap command returns an Unknown Command when player is not connected - by Runedog48 - 31.07.2011, 05:01
Re: Slap command returns an Unknown Command when player is not connected - by HydraX - 31.07.2011, 05:04
Re: Slap command returns an Unknown Command when player is not connected - by HydraX - 31.07.2011, 05:11
Re: Slap command returns an Unknown Command when player is not connected - by Jack_Leslie - 31.07.2011, 05:34
Re: Slap command returns an Unknown Command when player is not connected - by HydraX - 31.07.2011, 17:25
Re: Slap command returns an Unknown Command when player is not connected - by Toreno - 31.07.2011, 17:49
Re: Slap command returns an Unknown Command when player is not connected - by iPLEOMAX - 31.07.2011, 17:57
Re: Slap command returns an Unknown Command when player is not connected - by Toreno - 31.07.2011, 18:20
Re: Slap command returns an Unknown Command when player is not connected - by HydraX - 31.07.2011, 20:08
Re: Slap command returns an Unknown Command when player is not connected - by Toreno - 31.07.2011, 20:56
Re: Slap command returns an Unknown Command when player is not connected - by HydraX - 01.08.2011, 02:28
Re: Slap command returns an Unknown Command when player is not connected - by Toreno - 01.08.2011, 04:59
Re: Slap command returns an Unknown Command when player is not connected - by HydraX - 01.08.2011, 05:19

Forum Jump:


Users browsing this thread: 1 Guest(s)