30.11.2013, 13:27
I'm not mature with commands OnPlayerCommandText, So I used Zcmd and sscanf, Here you go
pawn Код:
CMD:slap(playerid, params[])
{
new id, reason[30];
if(sscanf(params, "is[30]", id, reason)) return SendClientMessage(playerid, -1, "Usage: /Slap [id] [reason]");
if(strlen(reason) < 1 || strlen(reason) > 30) return SendClientMessage(playerid, -1, "reason length must be between 1 - 30 characters");
if (PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GRAD1, "Your level isn't high enough to use this command");
if(!IsPlayerConnected(id) || id != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GRAD1, "Nemate pristup ovoj komandi!");
new Name[2][MAX_PLAYER_NAME],
Float:H,
Float:Pos[3],
string[128];
GetPlayerName(playerid, Name[0], MAX_PLAYER_NAME);
GetPlayerName(id, Name[1], MAX_PLAYER_NAME);
GetPlayerHealth(id, H);
SetPlayerHealth(id, H-5);
GetPlayerPos(id, Pos[0], Pos[1], Pos[2]);
SetPlayerPos(id, Pos[0], Pos[1], Pos[2]+5);
PlayerPlaySound(id, 1130, Pos[0], Pos[1], Pos[2]+5);
printf("[SLAP] %s je osamaren od strane Admina.",Name[0], Name[1]);
format(string, sizeof(string), "[SLAP] %s je osamaren od strane Admina ",Name[1], Name[0]);
BroadCast(COLOR_LIGHTRED,string);
return 1;
}