Dialog help
#1

Hello.

So I made this dialog to tow out vehicles, but i made it that players can't tow 20000 vehicles. so i made a loop to destroy the vehicle every time they tow. the problem is that every vehicle in the server gets destroyed.

new varible i made for the loop

PHP код:
new VehicleOwner[MAX_VEHICLES]; 
this is my code at OnDialogResponse
PHP код:
    1
    

Reply
#2

because 'new VehicleOwner' is always 0 so if player with ID 0 is connected it will destroy all vehicles
change to
pawn Код:
new VehicleOwner[MAX_VEHICLES] = {INVALID_PLAYER_ID, ...};
and after every DestroyVehicle add
pawn Код:
VehicleOwner[vehicle_id_here] = INVALID_PLAYER_ID;
Reply
#3

at this line

PHP код:
VehicleOwner[MAX_VEHICLES] = {INVALID_PLAYER_ID, ...}; 
what do i add instad the 3 dots i didn't understand.
Reply
#4

Nothing it sets full array as INVALID_ID
Reply
#5

ah ok thanks ill try it and btw i have an enum set for the vehicle model.

Код:
pVehicle1Model,
pVehicle2Model,
pVehicle3Model,
so it reacts like to 3 differents slots so at this line

Код:
VehicleOwner[vehicle_id_here] = INVALID_PLAYER_ID;
ill do this right?

Код:
VehicleOwner[pInfo[playerid][pVehicle1Model] || pInfo[playerid][pVehicle2Model] || pInfo[playerid][pVehicle3Model]   ] = INVALID_PLAYER_ID;
Reply
#6

No.
pawn Код:
VehicleOwner[GetPlayerVehicleID(playerid)] = INVALID_PLAYER_ID;
or in your loop
VehicleOwner[x] = INVALID_PLAYER_ID;
Reply
#7

alright thanks
Reply
#8

Works great! thank you for your help +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)