19.11.2016, 10:14
Follow this format:
PHP код:
CMD:seteventinfo(playerid, params[])
{
if(!IsAllowed(playerid, 3)) return NoAuth(playerid);
if(isnull(params))
{
SendClientMessage(playerid, COLOR_WHITE, "UASGE: /seteventinfo [option]");
SendClientMessage(playerid, COLOR_GREY, "Available Options: Health || Armour || Weapon || Position || Text");
return 1;
}
if (!strcmp(params, "health", true, 6))
{
if (params[6] != ' ' && params[6] != 0)
{
SendClientMessage(playerid, COLOR_WHITE, "UASGE: /seteventinfo [option]");
SendClientMessage(playerid, COLOR_GREY, "Available Options: Health || Armour || Weapon || Position || Text");
return 1;
}
new Float:hp;
if (sscanf(params[7], "f", 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(params, "text", true, 4))
{
if (params[4] != ' ' && params[4] != 0)
{
SendClientMessage(playerid, COLOR_WHITE, "UASGE: /seteventinfo [option]");
SendClientMessage(playerid, COLOR_GREY, "Available Options: Health || Armour || Weapon || Position || Text");
return 1;
}
new text[80];
if (sscanf(params[5], "s[80]", 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;
}
/*
if (!strcmp(params, "[OPTION]", true, LENGTH OF OPTION))
{
if (params[LENGTH OF OPTION] != ' ' && params[LENGTH OF OPTION] != 0)
{
SendClientMessage(playerid, COLOR_WHITE, "UASGE: /seteventinfo [option]");
SendClientMessage(playerid, COLOR_GREY, "Available Options: Health || Armour || Weapon || Position || Text");
return 1;
}
Use params[LENGTH OF OPTION + 1] in sscanf
}
*/
return 1;
}