13.12.2015, 19:22
Hi there. I am having this bug where I can't find a solution for it. Here is the code:
And This one:
So first of all when I get on my server and get in any car in my gamemode (including the Manana's AND any other car), I get that "Something..." executed. Even if it's any car. Althoug when I change this:
Into this for example:
Then I simply don't have a problem. "Something..." is executed only when I enter that car. I tested it. So it's a Control Structure problem. The "||" (or) are supposed to mean "execute Something... when I enter VMManana1 or VMManana2 or VMManana3..." and so on. But why does it execute on ALL cars?
Also another thing: I have a seperate filterscript where I have stored all the vehicles, except I used the Manana's in my Gamemode. But somehow when I arrive near the Manana's I see them duplicated. I swear there is no more CreateVehicle's for Manana's found in my Gamemode or the filterscript. I am ABSOLUTELY sure about it. Why are there 16 Manana's instead of 8? What is duplicating them?
P.S. I had those Manana's in my filterscript before I created the code above, but I deleted them out of the filterscript (and compiled it) and added them in the Gamemode as well as imported them into Variables. Then the Manana's still keep duplicating.
Код:
public OnPlayerStateChange(playerid, newstate, oldstate) { if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { if(GetPlayerVehicleID(playerid) == VMManana1 || VMManana2 || VMManana3 || VMManana4 || VMManana5 || VMManana6 || VMManana7 || VMManana8) { Something... } } return 1; }
Код:
new VMManana1, VMManana2, VMManana3, VMManana4, VMManana5, VMManana6, VMManana7, VMManana8; public OnGameModeInit() { VMManana1 = CreateVehicle(410, 50.6609, -246.2147, 1.1500, -362.8800, -1, -1, 100); VMManana2 = CreateVehicle(410, 54.8561, -246.3267, 1.1500, -361.1999, -1, -1, 100); VMManana3 = CreateVehicle(410, 59.0317, -246.3769, 1.1500, -361.9201, -1, -1, 100); VMManana4 = CreateVehicle(410, 63.2701, -246.5288, 1.1500, -361.5000, -1, -1, 100); VMManana5 = CreateVehicle(410, 67.5284, -246.6424, 1.1500, -361.8001, -1, -1, 100); VMManana6 = CreateVehicle(410, 71.7640, -246.7473, 1.1500, -361.8599, -1, -1, 100); VMManana7 = CreateVehicle(410, 75.9283, -246.8683, 1.1500, -361.7397, -1, -1, 100); VMManana8 = CreateVehicle(410, 80.2232, -246.9288, 1.1500, -361.9799, -1, -1, 100); }
Код:
if(GetPlayerVehicleID(playerid) == VMManana1 || VMManana2 || VMManana3 || VMManana4 || VMManana5 || VMManana6 || VMManana7 || VMManana8)
Код:
if(GetPlayerVehicleID(playerid) == VMManana1)
Also another thing: I have a seperate filterscript where I have stored all the vehicles, except I used the Manana's in my Gamemode. But somehow when I arrive near the Manana's I see them duplicated. I swear there is no more CreateVehicle's for Manana's found in my Gamemode or the filterscript. I am ABSOLUTELY sure about it. Why are there 16 Manana's instead of 8? What is duplicating them?
P.S. I had those Manana's in my filterscript before I created the code above, but I deleted them out of the filterscript (and compiled it) and added them in the Gamemode as well as imported them into Variables. Then the Manana's still keep duplicating.