sscanf warning: Strings without a length are deprecated, please add a destination size. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: sscanf warning: Strings without a length are deprecated, please add a destination size. (
/showthread.php?tid=592848)
sscanf warning: Strings without a length are deprecated, please add a destination size. -
Zeddclarity - 30.10.2015
Код:
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
Re: sscanf warning: Strings without a length are deprecated, please add a destination size. -
AbyssMorgan - 30.10.2015
PHP код:
if(sscanf(params, "s[128]fi", string, heal, price))
Re: sscanf warning: Strings without a length are deprecated, please add a destination size. -
Sawalha - 30.10.2015
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
Re: sscanf warning: Strings without a length are deprecated, please add a destination size. -
Zeddclarity - 30.10.2015
Thank you both