SA-MP Forums Archive
Help please - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help please (/showthread.php?tid=172359)



Help please - bartje01 - 29.08.2010

Hey guys. I'm entering a trashmaster and it should show a textdraw.
It doesn't have any effect.
What's wrong?
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(GetVehicleModel(playerid == 408)) // Trashmaster
    {
    TextDrawShowForPlayer(playerid, Textdraw0);
    TextDrawShowForPlayer(playerid, Textdraw1);
    }
    return 1;
}



Re: Help please - CyNiC - 29.08.2010

Quote:
Originally Posted by bartje01
Посмотреть сообщение
Hey guys. I'm entering a trashmaster and it should show a textdraw.
It doesn't have any effect.
What's wrong?
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(GetVehicleModel(playerid == 408)) // Trashmaster
    {
    TextDrawShowForPlayer(playerid, Textdraw0);
    TextDrawShowForPlayer(playerid, Textdraw1);
    }
    return 1;
}
This function return the model of the vehicleid, so, you have what get the ID from vehicle of playerid.
How?
Your function will stay like this:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 408)
    {
    TextDrawShowForPlayer(playerid, Textdraw0);
    TextDrawShowForPlayer(playerid, Textdraw1);
    }
    return 1;
}



Re: Help please - Bumbis - 29.08.2010

Easier will be like this i think, but cynics code works too i guess.
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == 408)
    {
    TextDrawShowForPlayer(playerid, Textdraw0);
    TextDrawShowForPlayer(playerid, Textdraw1);
    }
    return 1;
}



Re: Help please - CyNiC - 30.08.2010

The ideal is put this code in the OnPlayerStateChange because if a player press the key ENTER and cancel the entrance on vehicle, the textdraw will be showed to player and will not hide more.
Like this:
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if(newstate ==  PLAYER_STATE_DRIVER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 408)
    {
    //your functions
    }
return 1;
}