SA-MP Forums Archive
[HELP] Not working - 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: [HELP] Not working (/showthread.php?tid=349208)



[HELP] Not working - JaKe Elite - 08.06.2012

Hello guys,
I have timer checks if player is in safe zone, if player is in safe zone
player weapons will be armed to 0, now i add a new feature to the safe zone script
when player enter in safe zone with hydra/hunter/rhino player will removed in vehicle
then the vehicle will be deleted but it seem like it don't work i try GetPlayerVehicleID
but it didn't work

here is the code

pawn Code:
public OnPlayerArea()
{
    foreach(Player, i)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInArea(i, 2231.822265, -1434.579711, 2375.822265, -1226.579711))
            {
                SetPlayerArmedWeapon(i, 0);
                if(IsPlayerInVehicle(i, HiddenVeh[0])) return 1;
                if(IsPlayerInVehicle(i, 432) || IsPlayerInVehicle(i, 520) || IsPlayerInVehicle(i, 425))
                {
                    RemovePlayerFromVehicle(i);
                    DestroyVehicle(GetPlayerVehicleID(i));
                    SendClientMessage(i, COLOR_RED, "*** You cannot bring a harmful/big vehicles inside the Safe Zone! ***");
                }
            }
        }
    }
    return 1;
}



Re: [HELP] Not working - iggy1 - 08.06.2012

IsPlayerInVehicle is done with vehicleids not modelids.

Also foreach only loops through connected players so you never need to do a connection check.


Re: [HELP] Not working - Vince - 08.06.2012

Please learn the difference between vehicleid and modelid!
pawn Code:
switch(GetVehicleModel(GetPlayerVehicleID(i)))
{
    case 425, 432, 520:
    {
        RemovePlayerFromVehicle(i);
        DestroyVehicle(GetPlayerVehicleID(i));
        SendClientMessage(i, COLOR_RED, "*** You cannot bring a harmful/big vehicles inside the Safe Zone! ***");
    }
}



Re: [HELP] Not working - JaKe Elite - 08.06.2012

thank you vince it work now rep++ both of you