26.09.2016, 13:26
Try this;
PHP код:
CMD:event(playerid, params[])
{
new type[12], optional[64];
if (PlayerInfo[playerid][pAdmin] < 3)
return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command.");
if (sscanf(params, "s[12]S()[64]", type, optional))
return SendClientMessage(playerid, COLOR_GREY, "USAGE: /event [create/destroy/open/close/start/stop/spawn/respawning/weapon]");
if (!strcmp(type, "create", true))
{
EventInfo[Created] = true;
EventInfo[SpawnHealth] = 100.0;
SendClientMessage(playerid, COLOR_YELLOW, "[ADMIN]: {FFFFFF}You have created an event.");
return 1;
}
else if (!strcmp(type, "weapon", true))
{
if (!EventInfo[Created])
return SendClientMessage(playerid, COLOR_RED, "There are no active events (type /event create to create one).");
new slot, weaponid, ammo;
if (sscanf(optional, "ddd", slot, weaponid, ammo))
return SendClientMessage(playerid, COLOR_GREY, "USAGE: /event weapon [slot] [weaponid] [ammo]");
if (slot < 0 || slot > 12)
return SendClientMessage(playerid, COLOR_RED, "Invalid slot specified (valid are 0 to 12).");
if (weaponid < 0 || weaponid > 46)
return SendClientMessage(playerid, COLOR_RED, "You have specified an invalid weapon ID.");
if (slot != GetWeaponSlot(weaponid))
return SendClientMessageEx(playerid, COLOR_RED, "This weapon can't be put in this slot (put in %d instead).", GetWeaponSlot(weaponid));
if (ammo < 1)
return SendClientMessage(playerid, COLOR_RED, "The amount of ammo must be at least 1.");
EventInfo[Weapon][slot] = weaponid;
EventInfo[WeaponAmmo][slot] = ammo;
}
else SendClientMessage(playerid, COLOR_GREY, "USAGE: /event [create/destroy/open/close/start/stop/spawn/respawning/weapon]");
return 1;
}