08.05.2012, 16:28
pawn Код:
COMMAND:slap(playerid, params[])
{
new string[208 + MAX_PLAYER_NAME],PlayerN[MAX_PLAYER_NAME],OtherN[MAX_PLAYER_NAME];
new Float:x, Float:y, Float:z;
if(AccountInfo[playerid][AdminLevel] >= 1)
{
new targetid,String[156];
if(sscanf(params,"us", targetid,String)) return SendClientMessage(playerid, COLOR_WHITE, ""WHITE"Usage: "GREEN"/slap "WHITE"[playerid] [REASON]");
if(targetid == playerid) return SendClientMessage(playerid, COLOR_RED, "You Can't Slap Yourself !");
if(AccountInfo[playerid][AdminLevel] < AccountInfo[targetid][AdminLevel]) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You can't use this command on A Higher Level Admin Then You!");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid PlayerID"RED"(Player Not Connected)!");
if(String <= 4) return SendClientMessage(playerid, COLOR_RED, "Your Reason Needs To Be More Than 4 Characters");
GetPlayerName(playerid,PlayerN,sizeof(PlayerN));
GetPlayerName(targetid,OtherN,sizeof(OtherN));
GetPlayerPos(OtherN,x,y,z);
SetPlayerPos(OtherN,z,y,z +5);
format(string, sizeof(string), ""BLUE"\"%s\""RED" Was Slaped By Admin "BLUE"\"%s\""RED" Reason: %s", OtherN, PlayerN,String);
SendClientMessageToAll(COLOR_BRIGHTRED, string);
printf("\"%s\"Was Slapped By Admin \"%s\" Reason %s",OtherN, PlayerN,String);
}
else
{
SendClientMessage(playerid,COLOE_WHITE,"You Are Not Hight Enough level to use this Command");
}
return 1;
}
pawn Код:
if(AccountInfo[playerid][AdminLevel] < AccountInfo[playerid][AdminLevel]) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You can't use this command on A Higher Level Admin Then You!");
//and
if(String[0] <= 4) return SendClientMessage(playerid, COLOR_RED, "Your Reason Needs To Be More Than 4 Characters");
And not positive, haven't scripted in a while, but why would you write String[0] if the string length is already defined.
Plus, you made the player/target name variables [MAX_PLAYERS] when it should be [MAX_PLAYER_NAME] I presume.
EDIT: Just saw your new post, it should be:
pawn Код:
GetPlayerPos(targetid,x,y,z);
SetPlayerPos(targetid,z,y,z +5);