[OnPlayerEnterVehicle] Allowing people to enter faction-restricted car vehicles as passengers only. -
Uberanwar - 06.04.2015
Hi everyone, I have faction-restricted vehicles in my server. I'm using OnPlayerEnterVehicle (and no I won't use OnPlayerStateChange on this because I want to prevent players from entering the vehicle before they gets in)
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(ispassenger == 0) //only driver
{
for(new i = 0; i < 37; i++)
{
if(vehicleid == LSPD_Vehicles[i])
{
if(gTeam[playerid] != LSPD && PlayerInfo[playerid][aLevel] < 3)
{
ClearAnimations(playerid);
SendClientMessage(playerid, COLOR_RED, "ERROR: {FFFFFF}You are not in LSPD!");
}
}
}
However, when I'm in other factions (which is not LSPD), I can still enter the vehicle as passenger and driver. How do I fix this?
Re: [OnPlayerEnterVehicle] Allowing people to enter faction-restricted car vehicles as passengers only. -
Evocator - 06.04.2015
Show me how're you setting LSPD_Vehicles
Re: [OnPlayerEnterVehicle] Allowing people to enter faction-restricted car vehicles as passengers only. -
Uberanwar - 06.04.2015
LSPD Vehicle arrays. Is that you are asking?
Re: [OnPlayerEnterVehicle] Allowing people to enter faction-restricted car vehicles as passengers only. -
Evocator - 06.04.2015
Are you sure youre into the vehicle ID? or the model? Also i think that your looping wrongly, why 37?
Re: [OnPlayerEnterVehicle] Allowing people to enter faction-restricted car vehicles as passengers only. -
Uberanwar - 06.04.2015
Yes, I'm sure its the vehicle ids. No, I didn't loop wrongly. I have total of 37 LSPD vehicles.
This code actually works before I attempted to code and make so that players could get in as passengers.
I've just added if(ispassenger == 0) //only driver
{
on top, but its a fail.
Re : [OnPlayerEnterVehicle] Allowing people to enter faction-restricted car vehicles as passengers only. -
streetpeace - 06.04.2015
I've got this problem two months ago. You'll have to use timers to detect if a player is inside a LSPD Vehicle etc.. OnPlayerEnterVehicle has some bugs so..
Re: [OnPlayerEnterVehicle] Allowing people to enter faction-restricted car vehicles as passengers only. -
Uberanwar - 08.04.2015
Oh, I see. Well... I guess there isn't any fix for this. I'll try to use the other ways, thank you for your responses everyone.
Re: [OnPlayerEnterVehicle] Allowing people to enter faction-restricted car vehicles as passengers only. -
Matess - 08.04.2015
It should work if you are doing everything right. Print gteam or everything. You are also checking if the player isnt admin. You maybe forgot that you are admin no?
Re: [OnPlayerEnterVehicle] Allowing people to enter faction-restricted car vehicles as passengers only. -
Uberanwar - 08.04.2015
Quote:
Originally Posted by Matess
It should work if you are doing everything right. Print gteam or everything. You are also checking if the player isnt admin. You maybe forgot that you are admin no?
|
Oh, wow wtf (facepalm) .___________. I forgot. I didn't realize I have admin level on that account. Thank you for reminding. I'll check it out now and will update about this soon.
Re: [OnPlayerEnterVehicle] Allowing people to enter faction-restricted car vehicles as passengers only. -
Uberanwar - 08.04.2015
Now I realized the code is actually correct and working. Thanks for your responses guys.