small problem - formating -
Alvin007 - 25.02.2015
This is the Line 701 that shows errors.
PHP код:
format(FactionInfo[id][fName],sizeof(FactionInfo[id][fName]),fname);
I tried also:
PHP код:
format(FactionInfo[id][fName],sizeof(FactionInfo[id][fName]),"%s",fname);
but same error message.
Quote:
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 701) : error 001: expected token: "]", but found "-identifier-"
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 701) : warning 215: expression has no effect
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 701) : error 001: expected token: ";", but found "]"
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 701) : error 029: invalid expression, assumed zero
C:\Users\moka\Desktop\PROG\03z\gamemodes\test.pwn( 701) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
|
Knowing that fname is going to be inserted.
PHP код:
new txt,fname[28], type, vworld, Float:Xi, Float:Yi, Float:Zi, inti;
if(sscanf(params, "s[28]ddfffd", fname, type, inti, Xi, Yi, Zi, txt))
Re: small problem - formating -
DanishHaq - 25.02.2015
pawn Код:
// if I was you I'd use strmid instead of format like this
strmid(FactionInfo[id][fName], fname, 0, strlen(fname));
If this doesn't work it'd be useful to see everything around line 701 too to identify the problem a bit more.
Re : small problem - formating -
Alvin007 - 25.02.2015
Works fine, but i'd like to know what's wrong with format.
I mean in my case.
Re: small problem - formating -
DanishHaq - 25.02.2015
I don't know exactly, but what I do know is that strmid would be used for storing things in variables with enumerators (XInfo[var][var]) etc. and format is used for putting text together, for example "Admin Alvin007 has said hello to you", you'd need to format this because it has a variable that needs to be put in.
As I said because I don't know exactly the wording is a little noobish, I think someone else will be able to help you with a more lengthy statement. Or just check out the SA-MP wiki, general wikis etc., I'm sure you'll find your answer there.
Re : small problem - formating -
Alvin007 - 25.02.2015
Ok understood! i got it now, thanks alot
Re : small problem - formating -
Alvin007 - 25.02.2015
OUPS!
careful, it is strmid(FactionInfo[id][fName], fname, 0, strlen(fname),29); instead, you forgot about the last parameter which is the destination's length.
Re: small problem - formating -
CalvinC - 26.02.2015
It will work if you use your string size instead of using sizeof.
Hence why i showed you an example that didn't use sizeof.