Arrest command is not working for me.
#1

Basically it works, the putting in jail and taking the money also away works like clockwork. Loops all the players around you in range 5. But I have some problems, currently when I'm a cop, it's saying me you cant arrest co - workers!
That's the SendClientMessage line:
pawn Код:
if(PlayerInfo[i][pTiim] != 1 || PlayerInfo[i][pTiim] != 2) return SendClientMessage(playerid, C_RED, "SERVER: Sa ei tohi kaastццtajaid vangistada!");
So, how should it work then? And at the moment, is the range thing I made correct?
pTiim 0 = COP
pTiim 1 = ROBBER
pTiim 2 = CIVILIAN

pawn Код:
CMD:arreteeri(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        GetPlayerPos(i, x, y, z);
        IsPlayerInRangeOfPoint(playerid, 5, x, y, z);
        {
            if(IsPlayerConnected(i))
            {
                if(PlayerInfo[playerid][pTiim] != 0) return SendClientMessage(playerid, C_RED, "SERVER: Sa pead olema politseinik, et seda teha!");
                {
                    if(PlayerInfo[i][pTiim] != 1 || PlayerInfo[i][pTiim] != 2) return SendClientMessage(playerid, C_RED, "SERVER: Sa ei tohi kaastццtajaid vangistada!");
                    {
                            new mangijale[64], politseile[128], pNimi[MAX_PLAYER_NAME], wantedlevel;
                            wantedlevel = GetPlayerWantedLevel(i);
                            new rahatrahv = 1000*wantedlevel + random(800);
                            GivePlayerMoney(i, -rahatrahv);
                            SetTimerEx("Vangla", 1000*10*wantedlevel, false, "i");

                            SetPlayerVirtualWorld(i, 2);
                            SetPlayerInterior(i, 6);
                            SetPlayerPos(i, 264.2021,77.7526,1001.0391);


                            GetPlayerName(i, pNimi, sizeof(pNimi));
                            format(mangijale, sizeof(mangijale), "PCPD: Sind vangistati siia ning said trahvi %d$.", rahatrahv);
                            SendClientMessage(i, C_RED, mangijale);
                            format(politseile, sizeof(politseile), "VANGIMAJA: Sa vangistasid kasutaja %s seaduserikkumise eest!", pNimi);
                            SendClientMessage(playerid, C_BLUE, politseile);
                    }
                }
            }
        }
    }
    return 1;
}
Reply
#2

HELP=!!=!?!?!
Reply
#3

pawn Код:
if(PlayerInfo[i][pTiim] != 1 || PlayerInfo[i][pTiim] != 2) return SendClientMessage(playerid, C_RED, "SERVER: Sa ei tohi kaastццtajaid vangistada!");
Well, this will always return here, because either the player is supposed to be NOT 1 or to be NOT 2, so in any case one of both is true.

Should be:
pawn Код:
if(PlayerInfo[i][pTiim] == 0) return SendClientMessage(playerid, C_RED, "SERVER: Sa ei tohi kaastццtajaid vangistada!");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)