suhrab_mujeeb
Unregistered
Quote:
Originally Posted by SomebodyAndMe
pawn Код:
COMMAND:slap(playerid,params[]) { new OtherPlayer, Msg[170], Name[24], Message[150], OtherPlayerName[24], Float:x, Float:y, Float:z; if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "[ERROR]: You don't have access!"); else if(sscanf(params, "rs[170]", OtherPlayer, Message)) return SendClientMessage(playerid,0xFFFFFFFF, "SYNTAX: /slap <name/id> <reason>"); GetPlayerName(playerid, Name, sizeof(Name)); GetPlayerName(OtherPlayer, OtherPlayerName, sizeof(OtherPlayerName)); format(Msg, sizeof(Msg), "{FF6600}%s {FFFFFF}slaps {FF6600}%s {FFFFFF}because: {FF6600}%s", Name, OtherPlayerName, Message); SendClientMessageToAll(0xFFFFFFFF, Msg); GetPlayerPos(OtherPlayer, x, y, z); SetPlayerPos(OtherPlayer, x, y, z+5);
return 1; }
Untested
|
Quote:
Originally Posted by grand.Theft.Otto
RandomGuy, your line says:
pawn Код:
if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "NOPE!");
That says if the player IS and admin, it will return the error. Make sure you add an exclamation mark (means ' NOT ' in pawn language)
pawn Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "NOPE!");
https://sampwiki.blast.hk/wiki/Control_Structures#Operators
|
I guess you don't understand the difference between (IsPlayerAdmin(playerid)) and (!IsPlayerAdmin(playerid)).
Why would you send a message to the admins saying "[ERROR]: You don't have access!" or is it not for the admins?