SA-MP Forums Archive
Anti Car-Warping is not working as it should - 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: Anti Car-Warping is not working as it should (/showthread.php?tid=519036)



Deleted. - iFiras - 12.06.2014

Deleted.


Deleted. - iFiras - 13.06.2014

Deleted.


Re: Anti Car-Warping is not working as it should - MacT - 13.06.2014

show me admin enum when player is admin or not ?


Re: Anti Car-Warping is not working as it should - Sojo12 - 13.06.2014

Read the question well...it's not related to the enums.In fact,he's saying that it not even detecting the player warping.


Re: Anti Car-Warping is not working as it should - MacT - 13.06.2014

Quote:
Originally Posted by Sojo12
Посмотреть сообщение
Read the question well...it's not related to the enums.In fact,he's saying that it not even detecting the player warping.
Are you blinded? I asking becuase maybe set anti car wrapping if plaver is not admin and his state is drriver when he will kicked.


Re: Anti Car-Warping is not working as it should - Sojo12 - 13.06.2014

Before it reachs to the admin thing whether he should be kicked /or not.First it should eb working right?


Re: Anti Car-Warping is not working as it should - MacT - 13.06.2014

no I mean that.
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)

        if(newstate == PLAYER_STATE_DRIVER  && pAdmin[playerid] == 0)
        {
                  if((GetTickCount()-GetPVarInt(playerid, "CarTime")) < 1000)
                 {
                        SetPVarInt(playerid, "CarWarp", GetPVarInt(playerid, "CarWarp")+1);
                        if(GetPVarInt(playerid, "CarWarp") >= 5)
                       {
                            new pname[24];
                            new string[128];
                            GetPlayerName(playerid,pname,24);
                            format(string,sizeof(string),""COL_RED"%s(%d) has been kicked for car warping hack.",pname,playerid);
                            SendClientMessageToAll(-1,string);
                            printf(string);
                            Ban(playerid);
                         }
                }
                SetPVarInt(playerid, "CarTime", GetTickCount());
        }
        return 1;
}



Deleted. - iFiras - 15.06.2014

Deleted.


Re: Anti Car-Warping is not working as it should - Yera96 - 15.06.2014

This code looks better in my opinion. When player warps a vehicle OnPlayerEnterVehicle is not called. So put a variable which says that OnPlayerEnterVehicle is called.

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    SetPVarInt(playerid, "CurrentVehicle", vehicleid);
    return 1;
}
And when OPSC is called, check if player's current vehicle matches the variable we set in OPEV.
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2 || newstate == 3)
    {
        if(GetPVarInt(playerid, "CurrentVehicle") != GetPlayerVehicleID(playerid))
        {
            Kick(playerid);
        }
    }
    return 1;
}
Sorry for my english.