26.10.2010, 22:25
Theres a lot wrong with your command. First you're using 256 bytes for two strings each. You don't need that much!
Second of all, you're forgetting the whole point of zcmd.
Processing speed + short amount of scripting.
Third, as stated above it's best to use sscanf with zcmd, it makes things much more easy for the usage.
Try this for the first part only, you'll need to add in the reason part.
From there you can edit it to your liking. This is just a shorter way I believe, and much more organized
Edit: I'm not the best guy at scripting but I'll attempt trying to add in the reason part.
Sorry if I made any mistakes. I'm still new to scripting
Second of all, you're forgetting the whole point of zcmd.
Processing speed + short amount of scripting.
Third, as stated above it's best to use sscanf with zcmd, it makes things much more easy for the usage.
Try this for the first part only, you'll need to add in the reason part.
pawn Код:
command(slap, playerid, params[])
{
new id, Float:x, Float:y, Float:z;
if(PlayerInfo[playerid][Level] < 2)
return false;
if(sscanf(params, "u", id))
return SendClientMessage(playerid, COLOR_WHITE, "USE: /slap [playerid] [reason/with]");
if(!IsPlayerConnectedEx(id))
return SendClientMessage(playerid, COLOR_WHITE, "You need to login to use that command.");
GetPlayerPos(id, x, y, z);
SetPlayerPos(id, x, y, z+5);
format(string, sizeof(string), "You have slapped player %s!", GetName(id));
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "Administrator %s has slapped you!", GetName(playerid));
SendClientMessage(id, COLOR_RED, string);
return 1;
}
Edit: I'm not the best guy at scripting but I'll attempt trying to add in the reason part.
pawn Код:
command(slap, playerid, params[])
{
new id, reason[105], Float:x, Float:y, Float:z;
if(PlayerInfo[playerid][Level] < 2)
return false;
if(sscanf(params, "u", id))
return SendClientMessage(playerid, COLOR_WHITE, "USE: /slap [playerid] [reason/with]");
if(!IsPlayerConnectedEx(id))
return SendClientMessage(playerid, COLOR_WHITE, "You need to login to use that command.");
GetPlayerPos(id, x, y, z);
SetPlayerPos(id, x, y, z+5);
format(string, sizeof(string), "You have slapped player %s for reason: %s", GetName(id), reason);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "Administrator %s has slapped you for reason: %s", adminname, reason);
SendClientMessage(id, COLOR_RED, string);
return 1;
}
Sorry if I made any mistakes. I'm still new to scripting