SA-MP Forums Archive
Why get errors ? - 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: Why get errors ? (/showthread.php?tid=485890)



Why get errors ? - barts - 06.01.2014

PHP код:
stock EngineColor(playerid) {
    new 
str[5];
    if(
EngineStatus[playerid] == 0)
        
format(strsizeof(str), "r");
    if(
EngineStatus[playerid] == 1)
        
format(strsizeof(str), "g");
    return 
str;

PHP код:
 error 029invalid expressionassumed zero
warning 215
expression has no effect
error 001
expected token";"but found "]"
error 029invalid expressionassumed zero
too many error messages on one line 



Re: Why get errors ? - offon - 06.01.2014

The code you posted is correct. It is working for me.

Could you show us the lines where the errors are?


Re: Why get errors ? - Sawalha - 06.01.2014

pawn Код:
stock EngineColor(vid)
{
    new str[6];
    if(EngineStatus[playerid] == 0) str = "r";
    if(EngineStatus[playerid] == 1) str = "g";
    return str;
}



Re: Why get errors ? - MatriXgaMer - 06.01.2014

What are you trying to do with that command ?


Re: Why get errors ? - barts - 06.01.2014

All of the errors are on this line:
Quote:

if(EngineStatus[playerid] == 0)

I want to do a textdraw:
PHP код:
        format(strsizeof(str), "Engine: ~%s~%d \%"EngineColor(playerid), CarEngine[playerid]);
        
speedo4[playerid] = TextDrawCreate(470.0420.0" ");
        
TextDrawSetString(speedo4[playerid], str);
        
TextDrawSetShadow(speedo4[playerid], false);
        
TextDrawSetOutline(speedo4[playerid], 1);
        
TextDrawLetterSize(speedo4[playerid], TEXT_DRAW_X_FACTORTEXT_DRAW_Y_FACTOR);
        
TextDrawSetProportional(speedo4[playerid], 1);
        
TextDrawFont(speedo4[playerid], TEXT_DRAW_FONT);
        
TextDrawShowForPlayer(playeridspeedo4[playerid]); 
@Sawalha i have the same errors with your code


Re: Why get errors ? - Sawalha - 06.01.2014

you forgot "{"
if(EngineStatus[playerid] == 0)
{
format(str // etc..
}
if(EnginteStatus[playerid] == 1)
{
// etc etc
}


Re: Why get errors ? - barts - 06.01.2014

Same erros


Re: Why get errors ? - Sawalha - 06.01.2014

Try my old code with str = "g"; and others, but chane EngineStatus(vid) to EngineStatus(playerid)


Re: Why get errors ? - barts - 06.01.2014

this fucken pawno, i renamed the stock and it works
I dont have stocks with that name, dont know why