18.11.2016, 09:08
Hey guys, I am having a little issue with my event system
Every options except of "Position" simply returns nothing
For example:
Input: /seteventinfo health 100
Output: nothing
Here is the code
Anyone ?
Every options except of "Position" simply returns nothing
For example:
Input: /seteventinfo health 100
Output: nothing
Here is the code
PHP код:
CMD:seteventinfo(playerid, params[])
{
if(!IsAllowed(playerid, 3)) return NoAuth(playerid);
new option[10];
if(sscanf(params, "s[10]", option))
{
SendClientMessage(playerid, COLOR_WHITE, "UASGE: /seteventinfo [option]");
SendClientMessage(playerid, COLOR_GREY, "Available Options: Health || Armour || Weapon || Position || Text");
return 1;
}
if(!strcmp(option, "position", true))
{
GetPlayerPos(playerid, EventPos[0], EventPos[1], EventPos[2]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have set the event spawn-point at your position.");
return 1;
}
if(!strcmp(option, "health", true))
{
new Float:hp;
if(sscanf(params, "s[10]f", option, hp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /seteventinfo health [amount]");
EventHealth = hp;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have set the new event health amount.");
return 1;
}
if(!strcmp(option, "armour", true))
{
new Float:ap;
if(sscanf(params, "s[10]f", option, ap)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /seteventinfo armour [amount]");
EventArmour = ap;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have set the new event armour amount.");
return 1;
}
if(!strcmp(option, "weapon", true))
{
new slot, weaponid, ammo;
if(sscanf(params, "s[10]iii", option, slot, weaponid, ammo)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /seteventinfo weapon [slot] [weapon] [ammo]");
if(slot < 1 || slot > 3) return SendClientMessage(playerid, COLOR_GREY, "Slots are between 1 to 3.");
if(GetWeaponSlot(weaponid) == -1) return SendClientMessage(playerid, COLOR_WHITE, "Invalid weapon ID.");
if(ammo < 1) return SendClientMessage(playerid, COLOR_GREY, "Ammo must be 1 or higher.");
new string[128], weaponname[32];
EventWeapon[slot--] = weaponid;
EventAmmo[slot--] = ammo;
GetWeaponName(weaponid, weaponname, sizeof(weaponname));
format(string, sizeof(string), "You have set the %d event weapon slot to %s with %d bullets.", slot, weaponname, ammo);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
return 1;
}
if(!strcmp(option, "text", true))
{
new text[80];
if(sscanf(params, "s[10]s[80]", option, text)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /seteventinfo text [text]");
format(EventText, sizeof(EventText), "~r~%s", text);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have set the joining event game text.");
return 1;
}
return 1;
}