24.07.2013, 16:38
(
Последний раз редактировалось dominik523; 24.07.2013 в 17:40.
)
Hey there! I have one question. I got in my script that owned cars spawn when join, and it sets vehicle params so car will be locked and its engine won't be started. I tried in game with command to see boot status of all owned vehicles, and its -1. How is that possible because there are only 0 and 1 for each param. Here is my code:
When I type /trunk in the game for the first time, it will close my vehicle's trunk, which is already closed and I need to type it again to open it, just because of that -1. Please help me.
EDIT: I tried with every vehicle param, and they all are set to -1 when vehicle spawns, so the problem is not only with trunk
Код:
if(PlayerInfo[playerid][vModel]) { PlayerInfo[playerid][pVeh] = CreateVehicle(PlayerInfo[playerid][vModel], PlayerInfo[playerid][vX],PlayerInfo[playerid][vY],PlayerInfo[playerid][vZ],PlayerInfo[playerid][vA],PlayerInfo[playerid][vC1],PlayerInfo[playerid][vC2],1200); SetVehicleVirtualWorld(PlayerInfo[playerid][pVeh], PlayerInfo[playerid][pVehVW]); ChangeVehiclePaintjob(PlayerInfo[playerid][pVeh], PlayerInfo[playerid][vPJ]); if(PlayerInfo[playerid][vLocked]) SetVehicleParamsEx(PlayerInfo[playerid][pVeh], 0, 0, 0, 1, 0, 0, 0); for(new i=0; i<14; i++) { AddVehicleComponent(PlayerInfo[playerid][pVeh], PlayerInfo[playerid][pVehMod][i]); } }
Код:
// trunk command new Float:vx, Float:vy, Float:vz; // veh 1 GetVehiclePos(PlayerInfo[playerid][pVeh], vx, vy, vz); if(IsPlayerInRangeOfPoint(playerid, 4, vx, vy, vz)) { idx = PlayerInfo[playerid][pVeh]; if(IsBike(idx)) return SendClientMessage(playerid, COLOR_GREY, "This vehicle does not have trunk."); GetVehicleParamsEx(idx, engine, lights, alarm, doors, bonnet, boot, objective); if(boot == 0) { SetVehicleParamsEx(idx, engine, lights, alarm, doors, bonnet, 1, objective); format(string, sizeof(string), "* %s opens their vehicle's trunk.", RPN(playerid)); SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); } else { SetVehicleParamsEx(idx, engine, lights, alarm, doors, bonnet, 0, objective); format(string, sizeof(string), "* %s closes their vehicle's trunk.", RPN(playerid)); SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); } done = 1; return 1; }
EDIT: I tried with every vehicle param, and they all are set to -1 when vehicle spawns, so the problem is not only with trunk