31.07.2011, 17:49
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.
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;
}