SA-MP Forums Archive
Errors[rep] - 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: Errors[rep] (/showthread.php?tid=323334)



2 Problems[rep] - Dan_Barocu - 05.03.2012

hi i added more origins.


PHP код:
new otext[21];
            (
29393) >> if[PlayerInfo][pOrigin] == 1) { otext "Romania"; } 
PHP код:
Errors:
(
29393) : error 029invalid expressionassumed zero
(29393) : warning 215expression has no effect
(29393) : error 001expected token";"but found "]"
(29393) : error 029invalid expressionassumed zero
(29393) : fatal error 107too many error messages on one line 



Re: Errors[rep] - Konstantinos - 05.03.2012

pawn Код:
if([PlayerInfo][pOrigin] == 1) { otext = "Romania"; }
But why PlayerInfo into []?


Re: Errors[rep] - Dan_Barocu - 05.03.2012

PHP код:
if([PlayerInfo][pOrigin] == 1) { otext "Romania"; }  if it's like this ..same errors.. 



Re: Errors[rep] - Konstantinos - 05.03.2012

Post normal. I can't understand by like this, if like this.
The PlayerInfo is variable, isn't it? If yes, then you shouldn't use it inside [ ].
Is it for MAX_PLAYERS?


Re: Errors[rep] - Dan_Barocu - 05.03.2012

so how should it be??


Re: Errors[rep] - Konstantinos - 05.03.2012

This is what I am asking you?
Do you have for example:
pawn Код:
enum pInfo
{
    // More
    pOrigin,
    // Rest
}
new PlayerInfo[MAX_PLAYERS][pInfo];
If the pOrigin is in your enum you are using then you have to use it like this
pawn Код:
if( PlayerInfo[ playerid ][ pOrigin ] == 1 ) { otext = "Romania"; }



Re: Errors[rep] - Twisted_Insane - 05.03.2012

There is exactly everything right with this line:

pawn Код:
if(PlayerInfo[playerid][pOrigin]==1) { otext = "Romania"; }
Otherwise, maybe THIS is 'causing problems?

pawn Код:
{ otext = "Romania"; }



Re: Errors[rep] - Walsh - 05.03.2012

Quote:
Originally Posted by Twisted_Insane
Посмотреть сообщение
Otherwise, maybe THIS is 'causing problems?

pawn Код:
{ otext = "Romania"; }
That ain't it, I use a method like this as a stock to get a player's rank by an integer and return a string
pawn Код:
stock GetPlayerRank(playerid)
{
    new rank[30];
    switch(pInfo[playerid][pFaction])
    {
        case 1:
        {
            switch(pInfo[playerid][pRank])
            {
                case 0: rank = "Probie";
                case 1: rank = "EMT";
                case 2: rank = "Paramedic";
                case 3: rank = "Firefighter";
                case 4: rank = "Lieutenant";
                case 5: rank = "Chief";
            }
        }
        case 2:
        {
            switch(pInfo[playerid][pRank])
            {
                case 0: rank = "Explorer";
                case 1: rank = "Trainee";
                case 2: rank = "Deputy";
                case 3: rank = "Detective";
                case 4: rank = "Commissioner";
                case 5: rank = "Sheriff";
            }
        }
    }
    return rank;
}
and it works 100 percent.

Try this Dan, those brackets are redundant.
pawn Код:
if(PlayerInfo[playerid][pOrigin]==1) otext = "Romania";



2 Problems[rep] - Dan_Barocu - 05.03.2012

Fiexed 1 problem.) but where do i edit so if i disconnect from server and enter again i want the person to respawn from where he disconnected..where do i edit what i have to do?


Re: Errors[rep] - Dan_Barocu - 05.03.2012

please help with 2 second problem pleaseee