sscanf warning: Strings without a length are deprecated, please add a destination size.
#1

Код:
    new string[128], Float:heal, price;
    if(sscanf(params, "sfi", string, heal, price))
    {
        SendClientMessage(playerid, COLOR_RED, "? /createsprunk [vendingmachine] [heal bonus] [price]");
        return SendClientMessage(playerid, COLOR_RED, "  Type /vendingmachines");
    }
    for(new int = 0; int < sizeof(VendingMachines); int++)
    {
        if(strcmp(string, VendingMachines[int][vmName], true))
        for(new i = 0; i < MAX_VENDING_MACHINES; i++)
        {
			GetPlayerPos(playerid, SprunkMachines[i][SprunkObjectX1], SprunkMachines[i][SprunkObjectY1], SprunkMachines[i][SprunkObjectZ]);
			GetPlayerFacingAngle(playerid, SprunkMachines[i][SprunkObjectA]);
			SprunkMachines[i][SprunkHeal] = heal;
			SprunkMachines[i][SprunkPrice] = price;
			SprunkMachines[i][SprunkModelID] = VendingMachines[int][vmModel];
			SprunkMachines[i][SprunkCreated] = true;
	        new Float:X, Float:Y;
			SprunkMachines[i][SprunkObjectID] = CreateDynamicObject(SprunkMachines[i][SprunkModelID], SprunkMachines[i][SprunkObjectX1], SprunkMachines[i][SprunkObjectY1], SprunkMachines[i][SprunkObjectZ], 0.0, 0.0, SprunkMachines[i][SprunkObjectA]-180);
			X = SprunkMachines[i][SprunkObjectX1], Y = SprunkMachines[i][SprunkObjectY1];
			GetXYInFrontOfSprunk(X, Y, SprunkMachines[i][SprunkObjectA]);
			SprunkMachines[i][SprunkPickupID] = CreateDynamicPickup(1274, 23, X, Y, SprunkMachines[i][SprunkObjectZ]);
			SprunkMachines[i][SprunkObjectX2] = X, SprunkMachines[i][SprunkObjectY2] = Y;
			SprunkMachines[i][SprunkCreated] = true;
What is wrong with the code
Reply
#2

PHP код:

if(sscanf(params"s[128]fi"stringhealprice)) 
Reply
#3

in the sscanf function, if you are using a string, you have to declare it's value / length next to it's format code (s) between brackets, so the code will look:
Код:
if(sscanf(params, "s[128]fi", string, heal, price))
- nvm, morgan posted it before me
Reply
#4

Thank you both
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)