10.09.2018, 12:52
Here is, an example command:
pawn Код:
CMD:spawn(playerid, params[])
{
if (Player[playerid][AccountLevel] < 1) return 0;
new targetid;
if (sscanf(params, "u", targetid)) return SCM(playerid, COLOR_RED, "* [USAGE]: /spawn [playerid/name]");
if (! IsPlayerConnected(targetid)) return SCM(playerid, COLOR_RED, "* The specified player is not connected.");
if (Player[playerid][AccountLevel] < Player[targetid][AccountLevel]) return SCM(playerid, COLOR_RED, "* You cannot use this command on higher level admin.");
if (GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) TogglePlayerSpectating(targetid, false);
SpawnPlayer(targetid);
PlayerPlaySound(targetid, 1057, 0.0, 0.0, 0.0);
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
new buf[128];
format(buf, sizeof(buf), "* %s %s has respawned you.", AdminLevelName(playerid),ReturnName(playerid, 0));
SCM(targetid, COLOR_RED, buf);
format(buf, sizeof(buf), "* You have respawned %s.", ReturnName(targetid, 0));
SCM(playerid, COLOR_RED, buf);
return 1;
}