16.07.2014, 21:37
An example of a method I recommend you to use:
Alternative method, using callbacks (the correct way of how to use callbacks):
pawn Код:
CMD:resetweapon(playerid, params[])
{
// You don't always need to use callbacks, you can simply do this:
if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "SERVER: Unknown command.");
// Doing this will also prevent you from requiring an "else if" function.
new target;
// Instead of "i" (which is integer), we use "u" (user) so we can use player's names aswell and then return the message aswell.
if(sscanf(params, "u", target)) return SendClientMessage(playerid, COLOR_WARN, "USAGE: /resetweapon [playerid]");
ResetPlayerWeapons(target);
SendClientMessage(playerid, COLOR_WARN, "You removed the player's weapon.");
SendClientMessage(target, COLOR_RED, "You have been disarmed!");
return 1;
}
pawn Код:
CMD:resetweapon(playerid, params[])
{
new target;
if(sscanf(params, "u", target))
{
SendClientMessage(playerid, COLOR_WARN, "USAGE: /resetweapon [playerid]");
}
if (!IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, -1, "SERVER: Unknown command.");
}
else if(IsPlayerAdmin(playerid))
{
ResetPlayerWeapons(target);
SendClientMessage(playerid, COLOR_WARN, "You removed the player's weapon.");
SendClientMessage(target, COLOR_RED, "You have been disarmed!");
}
return 1;
}

