Is this possible
#1

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
Reply
#2

-delete-
Reply
#3

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.
Reply
#4

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.
Reply
#5

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;
}
Reply
#6

Quote:
Originally Posted by Calgon
Посмотреть сообщение
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.



Please do your research before posting at least. It's not hard to search this sort of thing...
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
Reply
#7

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?
Reply
#8

Nope, don't get mad at me for showing the right thing?
Reply
#9

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.
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)