SA-MP Forums Archive
Small help - 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 help (/showthread.php?tid=334253)



Small help - Face9000 - 14.04.2012

Hello,so i'm scripting a cops and robbers gamemode and i maked this code:

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(GetPlayerWantedLevel(playerid) >= 1) && gTeam[playerid] == TEAM_COP
    {
    GameTextForPlayer(playerid, "~b~~h~You can't choose cops team because you're wanted.Choose civilians", 5000, 6);
    return 0;
    }
    else return 1;
}
I've 2 teams,cops and civilians.Civilians has wanted level saved on the player file.The thing i wanna make,it's when a player reconnects and he gets back their wanted level,he cant choose COP as team but he can only choose CIVILIANS.So i made in that way and dont work.

I get this errors:

error 029: invalid expression, assumed zero
error 029: invalid expression, assumed zero
warning 225: unreachable code
error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found "return"


Re: Small help - doreto - 14.04.2012

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(GetPlayerWantedLevel(playerid) >= 1) && gTeam[playerid] == TEAM_COP
    {
        GameTextForPlayer(playerid, "~b~~h~You can't choose cops team because you're wanted.Choose civilians", 5000, 6);
    }
    else
    {
        bla bla
    }
    return 1;
}



Re: Small help - Stigg - 14.04.2012

Quote:
Originally Posted by doreto
Посмотреть сообщение
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(GetPlayerWantedLevel(playerid) >= 1) && gTeam[playerid] == TEAM_COP
    {
        GameTextForPlayer(playerid, "~b~~h~You can't choose cops team because you're wanted.Choose civilians", 5000, 6);
    }
    else
    {
        bla bla
    }
    return 1;
}
It will still give errors.

Try:

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(GetPlayerWantedLevel(playerid) >= 1 && gTeam[playerid] == TEAM_COP)//error was on this line
    {
        GameTextForPlayer(playerid, "~b~~h~You can't choose cops team because you're wanted.Choose civilians", 5000, 6);
    }
    else
    {
        //bla bla
    }
    return 1;
}



Re: Small help - Face9000 - 14.04.2012

Stigg,u forgot a return 0 after GameText,i fixed.

Thanks to both.