ONPLAYERENTERVEHICLE help
#1

sry for all caps but i want to attract people
so i made this:
PHP код:
    for(new 0sizeof(GsfCar); ++)
    {
        if(
vehicleid == GsfCar[j] && PlayerInfo[pInfo][pOrgID] <= 0)
           {
            
ClearAnimations(playerid);
             
GameTextForPlayer(playerid,"~r~ GROVE STREET FAMILIES",1250,4);
        }
        else if(
PlayerInfo[pInfo][pOrgID] > 1)
        {
            
ClearAnimations(playerid);
             
GameTextForPlayer(playerid,"~r~ GROVE STREET FAMILIES",1250,4);
        }
    }
    return 
1;

so if youre not from grove street you cant go to GSFvehicle
but problem is that even if youre in gsf you cant enter it
is there a way to allow it? like

if(PlayerInfo[playerid][pOrg] == 1)
{
EnterVehicle
}

i know it sounds cringey but is there command like entervehicle or such that is suitable for OnPlayerEnterVehicle??
Reply
#2

Код:
new GsfCar[2];

GsfCar[0] = CreateVehicle ... // ID 1
Create Vehicle ... // ID 2
Create Vehicle ... // ID 3
Create Vehicle ... // ID 4
GsfCar[1] = CreateVehicle ... // ID 5

// So you got the offset 1-5

OnPlayerEnterVehicle() {
if(vehicleid>=GsfCar[0]&&GsfCar[1]<=vehicleid) {
// This is a GSF Car
// Check if you belong to GSF , if not ClearAnimation
}
}
Or just move onto 2017 and write a dynamic car system where you save the 'GangID' and check if you belong to it.
Reply
#3

I don't understand why you have 2 checks doing the exact same thing...
Just simply change

Код:
    for(new j = 0; j < sizeof(GsfCar); j ++) { 
        if(vehicleid == GsfCar[j] && PlayerInfo[pInfo][pOrgID] != 1) { 
            ClearAnimations(playerid); 
             GameTextForPlayer(playerid,"~r~ GROVE STREET FAMILIES",1250,4); 
        }
    }
Reply
#4

in mistakes we learn
ty both of you +rep
Reply
#5

What ID is grove? I mean what PlayerInfo[pInfo][pOrgID] is grove?
Reply
#6

Quote:
Originally Posted by Kraeror
Посмотреть сообщение
What ID is grove? I mean what PlayerInfo[pInfo][pOrgID] is grove?
its fixed but it was 1
Reply
#7

Quote:
Originally Posted by n00blek
Посмотреть сообщение
its fixed but it was 1
Oh, okay they were faster than me
Reply
#8

Quote:
Originally Posted by n00blek
Посмотреть сообщение
in mistakes we learn
ty both of you +rep
Np we all need a learning curve lol, just remember less is best.
Reply
#9

Quote:
Originally Posted by Prokill911
Посмотреть сообщение
Np we all need a learning curve lol, just remember less is best.
Thats why you should use my version cause it doesnt require a for loop.
Reply
#10

Quote:
Originally Posted by whadez
Посмотреть сообщение
Thats why you should use my version cause it doesnt require a for loop.
Meh, I just fixed the code he provided, I didn't attempt to change the method of use.
If anything he should really store the vehicle information in a single place not have vehicles spawned under different arrays.

Should have one array for all vehicles and then have an enum inside that array to define if it's a public vehicle or not...

PHP код:
enum EVehicleInfo {
    
EVehicleOwner
// then simply assign public = 0, 1 = blah 2 = blah 3 = blah when a vehicle is created
};
new 
VehicleInfo[MAX_VEHICLES][EVehicleInfo];
if 
you want to set a car to x gang
do that else where in the script and just put
in this 
case...GsfCar
VehicleInfo
[vehicleid][1];
How he gets the vehicle id is up to him but thats just a 10 second example.
Then it would literally just be a case of
OnPlayerEnterVehicle
(playeridvehicleid) {
          new 
carowner VehicleInfo[vehicleid][EVehicleOwner];
          if(
carowner != BlahBlah) {
               do 
this
          
} else { do this }

I also get the above code may be lacking or wrong but I just spent 10 seconds on it so not really focusing on being 100% correct and working
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)