SA-MP Forums Archive
Small problem with the format() function - 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: Small problem with the format() function (/showthread.php?tid=314559)



Small problem with the format() function - AceFlyer - 30.01.2012

pawn Код:
format(HouseInformation[houseid][owner],sizeof(HouseInformation[houseid][owner]),"%s",dini_Get(filename,"owner"));//line-295
With the above code i get the following error
Код:
D:\Program Files\Server\filterscripts\AceHouses.pwn(93) : warning 217: loose indentation
D:\Program Files\Server\filterscripts\AceHouses.pwn(295) : error 001: expected token: "]", but found "-identifier-"
D:\Program Files\Server\filterscripts\AceHouses.pwn(295) : warning 215: expression has no effect
D:\Program Files\Server\filterscripts\AceHouses.pwn(295) : error 001: expected token: ";", but found "]"
D:\Program Files\Server\filterscripts\AceHouses.pwn(295) : error 029: invalid expression, assumed zero
D:\Program Files\Server\filterscripts\AceHouses.pwn(295) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
any idea how i can fix this?


Re: Small problem with the format() function - Konstantinos - 30.01.2012

Why you don't get the name with another way

pawn Код:
// An Example:
    new string[ 24 ]
    format(string,sizeof(string),"%s",dini_Get(filename,"owner"));

// Make sure on the enum "owner" is like this:
enum hInfo
{
    owner[ MAX_PLAYER_NAME ],
    // Rest
}
// And..( not sure )
HouseInformation[houseid][owner] = string;
Edit: Or the way user below said. Both works!


Re: Small problem with the format() function - eDz0r - 30.01.2012

try like this
pawn Код:
format(HouseInformation[houseid][owner], MAX_PLAYER_NAME, "%s", dini_Get(filename,"owner"));