SA-MP Forums Archive
onplayerentervehicle - 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: onplayerentervehicle (/showthread.php?tid=309428)



onplayerentervehicle - Tanush123 - 07.01.2012

i added
pawn Код:
if(modelid == 481 || 509 || 510) return SendClientMessage(playerid,red,"ERROR: You cannot on the engine for a bike");
under my /engine command but for some reason all vehicles shows that message, i did
pawn Код:
new modelid = GetVehicleModel(playerid);
this is my onplayerentervehicle script
pawn Код:
new vid = GetPlayerVehicleID(playerid);
    new modelid = GetVehicleModel(playerid);
    if(modelid == 481 || 509 || 510)
    {
        vengine[vid] = 1;
        GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(vid,true,lights,alarm,doors,bonnet,boot,objective);
    }
    if(vengine[vid] == 0)
    {
        SendClientMessage(playerid,lightyellow,"This vehicle engines are off, use /engine to on it");
    }
well i want if the model id is 481 509 510 (bicycles), it


Re: onplayerentervehicle - BlackWolf120 - 07.01.2012

use it like:

pawn Код:
if(modelid == 481 || modelid == 509 || modelid == /*etc..*/)



Re: onplayerentervehicle - suhrab_mujeeb - 07.01.2012

OnPlayerEnterVehicle is just called before entering the vehicle so GetPlayerVehicleID is useless because at that time that player is outside a vehicle. Try shifting it under ONPlayerStateChange.