enter vehicle message? - 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: enter vehicle message? (
/showthread.php?tid=230340)
enter vehicle message? -
justsomeguy - 23.02.2011
hello i have made an engine system that works with an key(lmb).
but i also need a message that appears when someone enters a vehicle that they have to press lmb to start the engine.
could enyone explaine how to do this?
thnks already!
Re: enter vehicle message? -
YungGee - 23.02.2011
Quote:
Originally Posted by justsomeguy
hello i have made an engine system that works with an key(lmb).
but i also need a message that appears when someone enters a vehicle that they have to press lmb to start the engine.
could enyone explaine how to do this?
thnks already!
|
Use the SendClientMessage and GameTextForPlayer functions under the OnPlayerEnterVehicle callback.
NOTE: Use OnPlayerStateChange if you don't like the message showing before they actually open the door if they enter the vehicle from a distance.
I can type it up if you like but i am sure you could manage now.
Re: enter vehicle message? -
justsomeguy - 23.02.2011
i used onplayerstatechange but the message just didnt show up
Re: enter vehicle message? -
YungGee - 23.02.2011
show me that whole callback..
Re: enter vehicle message? -
justsomeguy - 23.02.2011
here's the callback:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new PlayerName[24];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(newstate == PLAYER_STATE_DRIVER)
{
new Vehicle = GetPlayerVehicleID(playerid);
if(Vehicle == justsomeguy)
{ // It is, so we continue.
if(strcmp(PlayerName,"justsomeguy",true))
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, 0x33AA33AA, "I'm sorry, but this car has been reserved for justsomeguy");
}
}
}
return 1;
if(newstate == PLAYER_STATE_DRIVER) // kijk of de player in een auto stapt als driver
{
TogglePlayerControllable(playerid, 0); // freeze hem
EngineEnabled[playerid] = 0;
SendClientMessage(playerid, 0xFFFFFFAA, "Press LMB to start the engine."); // stuur hem een bericht
SetCameraBehindPlayer(playerid); // set de camera achter hem
}
return 1;
}
Re: enter vehicle message? -
MadeMan - 23.02.2011
pawn Код:
}
return 1;
if(newstate == PLAYER_STATE_DRIVER) // kijk of de player in een auto stapt als driver
{
Remove this
return 1;
pawn Код:
}
if(newstate == PLAYER_STATE_DRIVER) // kijk of de player in een auto stapt als driver
{
Re: enter vehicle message? -
justsomeguy - 23.02.2011
thanx it works now(also there was a flaw in my engine script its old cuz 0.3 has an engine systemXD)