small problem - formating
#1

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], typevworldFloat:XiFloat:YiFloat:Ziinti;
    if(
sscanf(params"s[28]ddfffd"fnametypeintiXiYiZitxt)) 
Reply
#2

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.
Reply
#3

Works fine, but i'd like to know what's wrong with format.
I mean in my case.
Reply
#4

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.
Reply
#5

Ok understood! i got it now, thanks alot
Reply
#6

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.
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)