sscanf
#6

Quote:
Originally Posted by JaKe Elite
Посмотреть сообщение
Try this;

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

Thank you!
Reply


Messages In This Thread
sscanf - by GoldenLion - 25.09.2016, 17:46
Re: sscanf - by SickAttack - 25.09.2016, 19:47
Re: sscanf - by Dayrion - 25.09.2016, 19:51
Re: sscanf - by GoldenLion - 26.09.2016, 13:08
Re: sscanf - by JaKe Elite - 26.09.2016, 13:26
Re: sscanf - by GoldenLion - 26.09.2016, 14:25

Forum Jump:


Users browsing this thread: 2 Guest(s)