sscanf warning: string buffer overflow
#1

Hey guys, I am having a little issue with sscanf, I am making an event admin CMD to set the event info (position, weapons, health etc) and only the position parameter works, all the rest simply do nothing and print a string buffer overflow warning to the console
anyone ?

PHP код:
    if(!strcmp(option"health"true))
    {
        new 
Float:hp;
        if(
sscanf(params"s[10]f"optionhp)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /seteventinfo health [amount]");
        
EventHealth hp;
        
SendClientMessage(playeridCOLOR_LIGHTBLUE"You have set the new event health amount.");
        return 
1;
    }
    if(!
strcmp(option"armour"true))
    {
        new 
Float:ap;
        if(
sscanf(params[6], "s[10]f"optionap)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /seteventinfo armour [amount]");
        
EventArmour ap;
        
SendClientMessage(playeridCOLOR_LIGHTBLUE"You have set the new event armour amount.");
        return 
1;
    }
    if(!
strcmp(option"weapon"true))
    {
        new 
slotweaponidammo;
        if(
sscanf(params"s[10]iii"optionslotweaponidammo)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /seteventinfo weapon [slot] [weapon] [ammo]");
        if(
slot || slot 3) return SendClientMessage(playeridCOLOR_GREY"Slots are between 1 to 3.");
        if(
GetWeaponSlot(weaponid) == -1) return SendClientMessage(playeridCOLOR_WHITE"Invalid weapon ID.");
        if(
ammo 1) return SendClientMessage(playeridCOLOR_GREY"Ammo must be 1 or higher.");
        new 
string[128], weaponname[32];
        
EventWeapon[slot--] = weaponid;
        
EventAmmo[slot--] = ammo;
        
GetWeaponName(weaponidweaponnamesizeof(weaponname));
        
format(stringsizeof(string), "You have set the %d event weapon slot to %s with %d bullets."slotweaponnameammo);
        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
        return 
1;
    }
    if(!
strcmp(option"text"true))
    {
        new 
text[80];
        if(
sscanf(params"s[10]s[80]"optiontext)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /seteventinfo text [text]");
        
format(EventTextsizeof(EventText), "~r~%s"text);
        
SendClientMessage(playeridCOLOR_LIGHTBLUE"You have set the joining event game text.");
        return 
1;
    } 
All those parameters shows nothing IG and warning on the console
Reply


Messages In This Thread
sscanf warning: string buffer overflow - by NeXoR - 19.11.2016, 08:40
Re: sscanf warning: string buffer overflow - by ranme15 - 19.11.2016, 09:04
Re: sscanf warning: string buffer overflow - by NeXoR - 19.11.2016, 09:19
Re: sscanf warning: string buffer overflow - by ranme15 - 19.11.2016, 09:22
Re: sscanf warning: string buffer overflow - by NeXoR - 19.11.2016, 09:26
Re: sscanf warning: string buffer overflow - by SyS - 19.11.2016, 09:32
Re: sscanf warning: string buffer overflow - by Stinged - 19.11.2016, 10:14
Re: sscanf warning: string buffer overflow - by NeXoR - 19.11.2016, 19:29
Re: sscanf warning: string buffer overflow - by Dayrion - 20.11.2016, 00:00
Re: sscanf warning: string buffer overflow - by Stinged - 20.11.2016, 05:54

Forum Jump:


Users browsing this thread: 2 Guest(s)