25.09.2016, 17:46
(
Последний раз редактировалось GoldenLion; 25.09.2016 в 19:43.
)
Hi, I'm creating an event system, but the problem is that my server crashes when I try to set the event's weapon. How could I make it work? I see that it's done totally wrong. I've never made commands that can do many things so it's a little bit confusing.
Here's the command:
Here's the command:
Код:
CMD:event(playerid, params[]) { new type[12]; if (PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command."); if (sscanf(params, "s[12]", type)) 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(params, "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; }