Train passenger - 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: Train passenger (
/showthread.php?tid=253365)
Train passenger -
Admigo - 06.05.2011
Heey guys
How can i make that players need to buy first a ticket before they can enter a train as passenger?
I think something with Removeplayerfromvehicle but dont work at me!
Код:
for(new i = 0; i < GetMaxPlayers(); i++)
{
if (IsPlayerInVehicle(i, 538) && GetPlayerState(i) == PLAYER_STATE_DRIVER)//I dont know how to make it in passenger:S
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,COLOR_RED,"You need to buy a ticket first!!.");
}
Pls help
Thanks admigo
Re: Train passenger -
Unknown1234 - 06.05.2011
add a variable like
at start
new Gotticket[MAX_PLAYERS];
and use Gotticket[playerid] =0; // 0 - disable , 1 - enable..
use control statements
Re: Train passenger -
Admigo - 06.05.2011
How can i do this?
Re: Train passenger -
Laronic - 06.05.2011
pawn Код:
new GotTrainTicket[MAX_PLAYERS];
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_PASSENGER)
{
if(GotTrainTicket[playerid] == 1)
{
SendClientMessage(playerid, 0xFFFFFFAA, "Enjoy the trip");
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, 0xFFFFFFAA, "You need a tricked to take this train!");
}
}
return 1;
}
Re: Train passenger -
Admigo - 06.05.2011
Dont work
It says that you need ticket but he dont removes you out the train:S
Re: Train passenger -
o_O - 06.05.2011
Soooooooooo funny. I did a code
exactly like this YESTERDAY!!!
Yeah, doesn't work. Set the player position like:
Код:
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(playerid,x+2,y+2,z+2);
That seems like the only possible thing to do.