Anti - 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: Anti (
/showthread.php?tid=609423)
Anti -
Ugaustin - 12.06.2016
how can I Disallow ENTER at job vehicles if player is doing job...

so players can do job !!
Re: Anti -
Xdrime - 12.06.2016
what do you mean ?
Re: Anti -
MBilal - 12.06.2016
Код:
#include <foreach> //at top if u don't have
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(!ispassenger)
{
foreach(Player,i)
{
if( i != playerid && GetPlayerVehicleID(i) == vehicleid && GetPlayerState(i) == PLAYER_STATE_DRIVER && PlayerWithJob[i])
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x , y , z);
SetPlayerPos(playerid, x , y , z + 1);
break;
}
}
}
return 1;
}
Hope it help you try it and if not work pm me
Re: Anti -
Ugaustin - 12.06.2016
I want to define PlayerWithJob with all job cars or something like that..could I?
Re: Anti -
MBilal - 12.06.2016
Well make that variable whenever player join any job set that = 1 and when he left any job set = 0.
Re: Anti -
Ugaustin - 12.06.2016
? I want enter to be disallowed??stop enter..
Re: Anti -
Ugaustin - 12.06.2016
I want or to stop enter or lock vehicle..
Re: Anti -
Ugaustin - 13.06.2016
how can I make it?? Disallow ENTER at job vehicles if player is doing job...

so players can do job !!
Re: Anti -
Sjn - 13.06.2016
MBilal already posted the clear example about how to do it. Why are you repeating yourself?
If you don't know how to use variables,
take your time reading this.
Re: Anti -
cuzido - 13.06.2016
Use
OnPlayerEnterVehicle.
You can stop the player from entering the vehicle if he's not doing the job like this:
PHP код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new model = GetVehicleModel(vehicleid);
if(model == 407){
if(Fireman[playerid] == 0){
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
SetPlayerPos(playerid,X,Y,Z);
SendClientMessage(playerid, COLOR_WHITE, "You don't have the fireman job.");
return 1;
}
}
return 1;
}