04.07.2014, 03:42
I have a problem displaying my vehicle's info...
It only works if I run a loop through all the vehicles to get the vehicle info... but it gives me the info for all the vehicles.
I made a function that is suppose to loop through and find the car's ID that matches the ID im in but it doesnt work...
Code:
Working:
Not working:
Function:
Please could someone help me
It only works if I run a loop through all the vehicles to get the vehicle info... but it gives me the info for all the vehicles.
I made a function that is suppose to loop through and find the car's ID that matches the ID im in but it doesnt work...
Code:
Working:
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { new str[128]; for(new i=1; i < MAX_DVEHICLES; i++) { format(str, sizeof(str), "Owner: %s | Price: %d", vInfo[i][vOwner], vInfo[i][vPrice]); SendClientMessage(playerid, -1, str); } return 1; }
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { new id = GetVehicleID(GetPlayerVehicleID(playerid)); new str[128]; format(str, sizeof(str), "Owner: %s | Price: %d", vInfo[id][vOwner], vInfo[id][vPrice]); SendClientMessage(playerid, -1, str); return 1; }
Код:
GetVehicleID(vehicleid) { for(new i=1; i < MAX_DVEHICLES; i++) { if(VehicleCreated[i] && VehicleID[i] == vehicleid) return i; } return 0; }
