Is this possible - 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: Is this possible (
/showthread.php?tid=357228)
Is this possible -
Euan Hughes - 06.07.2012
Well on the script i have now if you try and enter a faction locked car it lets you in then kicks you straight back out
What im wondering is it possible to be able to make it so if your not in that faction you cant even enter if so like when you pres a button to go to enter the vehicle it dont do anything
If you need anymore code just ask
Thanks
Please help
Re: Is this possible -
DBan - 06.07.2012
-delete-
Re: Is this possible -
Calgon - 06.07.2012
https://sampwiki.blast.hk/wiki/OnPlayerStateChange
https://sampwiki.blast.hk/wiki/OnPlayerEnterVehicle
You will need to add an if statement to check if the player is in the correct faction to enter the vehicle under OnPlayerStateChange for it to have the effect where it only tells you that you can't enter if you actually get in.
Re: Is this possible -
Basssiiie - 06.07.2012
Quote:
Originally Posted by DBan
Afaik, no, because well again afaik, SAMP cannot tell if you're entering a vehicle, but it can tell what vehicle you're in.
|
SAMP can tell if you're entering a vehicle. OnPlayerEnterVehicle is called when the player pressed the ENTER key and there is a vehicle nearby, resulting in the player walking towards the vehicle. If you lock the vehicle in OnPlayerEnterVehicle when you're not allowed to enter it, the player can't enter it, because your ped is still outside the vehicle when OnPlayerEnterVehicle is called.
Re: Is this possible -
milanosie - 06.07.2012
Quote:
Originally Posted by DBan
Afaik, no, because well again afaik, SAMP cannot tell what vehicle you're entering, but it can tell what vehicle you're in.
But who knows.
|
Bullshit, complete bullshit.
Here, take a look at my piece of code.
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(CarInfo[vehicleid][CarLock] == 1)
{
ClearAnimations(playerid);
}
if(ispassenger == 0)
{
if(familyteam[vehicleid] != 0 && familyteam[vehicleid] != PlayerInfo[playerid][Family])
{
ClearAnimations(playerid);
}
else if(vteam[vehicleid] > 0 && vteam[vehicleid] != PlayerInfo[playerid][Fmember] && vteam[vehicleid] != 59 && vteam[vehicleid] != 2994 && vteam[vehicleid] != 2995)
{
ClearAnimations(playerid);
}
else if(vjob[vehicleid] > 0 && vjob[vehicleid] != PlayerInfo[playerid][pJob])
{
ClearAnimations(playerid);
}
}
return 1;
}
Re: Is this possible -
Euan Hughes - 06.07.2012
Quote:
Originally Posted by Calgon
|
Thank you for your help
But i dont quite understand, Is it possible to make the player not enter the vehicle if they are not in the right faction ?
Thanks
Re: Is this possible -
DBan - 06.07.2012
Quote:
Originally Posted by milanosie
Bullshit, complete bullshit.
Here, take a look at my piece of code.
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { if(CarInfo[vehicleid][CarLock] == 1) { ClearAnimations(playerid); } if(ispassenger == 0) { if(familyteam[vehicleid] != 0 && familyteam[vehicleid] != PlayerInfo[playerid][Family]) { ClearAnimations(playerid); } else if(vteam[vehicleid] > 0 && vteam[vehicleid] != PlayerInfo[playerid][Fmember] && vteam[vehicleid] != 59 && vteam[vehicleid] != 2994 && vteam[vehicleid] != 2995) { ClearAnimations(playerid); } else if(vjob[vehicleid] > 0 && vjob[vehicleid] != PlayerInfo[playerid][pJob]) { ClearAnimations(playerid); } } return 1; }
|
lol
Okay, I was wrong, big deal, need 3 posts to point that out?
Re: Is this possible -
milanosie - 06.07.2012
Nope, don't get mad at me for showing the right thing?
Re: Is this possible -
Calgon - 06.07.2012
You'll need to show us some code from your script for your variables and stuff. i.e. a /r command for cops or something.
Re: Is this possible -
Euan Hughes - 06.07.2012
Quote:
Originally Posted by milanosie
Bullshit, complete bullshit.
Here, take a look at my piece of code.
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { if(CarInfo[vehicleid][CarLock] == 1) { ClearAnimations(playerid); } if(ispassenger == 0) { if(familyteam[vehicleid] != 0 && familyteam[vehicleid] != PlayerInfo[playerid][Family]) { ClearAnimations(playerid); } else if(vteam[vehicleid] > 0 && vteam[vehicleid] != PlayerInfo[playerid][Fmember] && vteam[vehicleid] != 59 && vteam[vehicleid] != 2994 && vteam[vehicleid] != 2995) { ClearAnimations(playerid); } else if(vjob[vehicleid] > 0 && vjob[vehicleid] != PlayerInfo[playerid][pJob]) { ClearAnimations(playerid); } } return 1; }
|
I am really confused what do i replace because i am getting undefined symbol errors and i dont know what im meant to change and what am i meant to change it for
Please help
Thanks