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; }
CMD:set(playerid, params[])
{
if(pAccount[playerid][pAdmin] < ADMIN) return ErrorMsg(playerid, false);
new
parametre[30+'\0'],
scmd[50];
if(sscanf(params, "s[30]S()[130]", parametre, scmd)) return SCM(playerid, LBLUE, "/set [money - score - kills - death - skin - vhp - v(irtual)w(orld) - int(erior)]");
if(!strcmp(parametre, "money"))
{
...
Put curly braces and the data type in the second usage of sscanf.
if (sscanf(params, "{s[7]}ddd", slot, weaponid, ammo)) |
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;
}
Try this;
PHP код:
|