ONPLAYERENTERVEHICLE help -
n00blek - 10.10.2017
sry for all caps but i want to attract people
so i made this:
PHP код:
for(new j = 0; j < sizeof(GsfCar); j ++)
{
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??
Re: ONPLAYERENTERVEHICLE help -
whadez - 10.10.2017
Код:
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.
Re: ONPLAYERENTERVEHICLE help -
Prokill911 - 10.10.2017
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);
}
}
Re: ONPLAYERENTERVEHICLE help -
n00blek - 10.10.2017
in mistakes we learn
ty both of you +rep
Re: ONPLAYERENTERVEHICLE help -
Kraeror - 10.10.2017
What ID is grove? I mean what PlayerInfo[pInfo][pOrgID] is grove?
Re: ONPLAYERENTERVEHICLE help -
n00blek - 10.10.2017
Quote:
Originally Posted by Kraeror
What ID is grove? I mean what PlayerInfo[pInfo][pOrgID] is grove?
|
its fixed but it was 1
Re: ONPLAYERENTERVEHICLE help -
Kraeror - 10.10.2017
Quote:
Originally Posted by n00blek
its fixed but it was 1
|
Oh, okay they were faster than me
Re: ONPLAYERENTERVEHICLE help -
Prokill911 - 10.10.2017
Quote:
Originally Posted by n00blek
in mistakes we learn
ty both of you +rep
|
Np
![Smiley](images/smilies/smile.png)
we all need a learning curve lol, just remember less is best.
Re: ONPLAYERENTERVEHICLE help -
whadez - 10.10.2017
Quote:
Originally Posted by Prokill911
Np ![Smiley](images/smilies/smile.png) 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.
Re: ONPLAYERENTERVEHICLE help -
Prokill911 - 10.10.2017
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(playerid, vehicleid) {
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