23.02.2013, 16:33
Hello fellow scripters,
I am working on a vehicle system, now I'm pretty much done and started working on commands like /lock, /engine and such but I got into a problem. If I use SetVehicleParamsEx manually ( With a command like /setvehicleparamsex [id] [engine] [lights] [alarm] [doors] [bonnet] [boot] [objective] ) it works but it doesn't work when I use it in a command. An example:
This doesn't work, it always keeps doing the if statement and sending the "> Vehicle door param set to: 1." message.
Then I even did this to make sure it does everything right:
With this the messages actually change and say "> Vehicle door param set to: 1" and then "> Vehicle door param set to: 0" and then the story begins again but it doesn't really change the params when I check it with this command:
If anyone knows why this is bugging, please help me!
Best regards,
Jesse
I am working on a vehicle system, now I'm pretty much done and started working on commands like /lock, /engine and such but I got into a problem. If I use SetVehicleParamsEx manually ( With a command like /setvehicleparamsex [id] [engine] [lights] [alarm] [doors] [bonnet] [boot] [objective] ) it works but it doesn't work when I use it in a command. An example:
pawn Код:
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(VehicleID, engine, lights, alarm, doors, bonnet, boot, objective);
if(doors != 1)
{
SetVehicleParamsEx(VehicleID, engine, lights, alarm, 1, bonnet, boot, objective);
SendClientMessage(playerid, COLOR_WHITE, "> Vehicle door param set to: 1.");
}
else
{
SetVehicleParamsEx(VehicleID, engine, lights, alarm, 0, bonnet, boot, objective);
SendClientMessage(playerid, COLOR_WHITE, "> Vehicle door param set to: 0.");
}
Then I even did this to make sure it does everything right:
pawn Код:
GetVehicleParams(vehicleid, &engine, &lights, &alarm, &doors, &bonnet, &boot, &objective)
{
engine = Vinfo[vehicleid][EngineOn];
lights = Vinfo[vehicleid][LightsOn];
alarm = Vinfo[vehicleid][AlarmOn];
doors = Vinfo[vehicleid][DoorsLocked];
bonnet = Vinfo[vehicleid][BonnetOpen];
boot = Vinfo[vehicleid][BootOpen];
objective = Vinfo[vehicleid][ObjectiveOn];
return 1;
}
SetVehicleParams(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective)
{
Vinfo[vehicleid][EngineOn] = engine;
Vinfo[vehicleid][LightsOn] = lights;
Vinfo[vehicleid][AlarmOn] = alarm;
Vinfo[vehicleid][DoorsLocked] = doors;
Vinfo[vehicleid][BonnetOpen] = bonnet;
Vinfo[vehicleid][BootOpen] = boot;
Vinfo[vehicleid][ObjectiveOn] = objective;
SetVehicleParamsEx(vehicleid, Vinfo[vehicleid][EngineOn], Vinfo[vehicleid][LightsOn], Vinfo[vehicleid][AlarmOn], Vinfo[vehicleid][DoorsLocked], Vinfo[vehicleid][BonnetOpen], Vinfo[vehicleid][BootOpen], Vinfo[vehicleid][ObjectiveOn]);
return 1;
}
new string[35], engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParams(VehicleID, engine, lights, alarm, doors, bonnet, boot, objective);
if(doors != 1)
{
SetVehicleParams(VehicleID, engine, lights, alarm, 1, bonnet, boot, objective);
GetVehicleParams(VehicleID, engine, lights, alarm, doors, bonnet, boot, objective);
format(string, sizeof(string), "> Vehicle door param set to: %d.", doors);
}
else
{
SetVehicleParams(VehicleID, engine, lights, alarm, 0, bonnet, boot, objective);
GetVehicleParams(VehicleID, engine, lights, alarm, doors, bonnet, boot, objective);
format(string, sizeof(string), "> Vehicle door param set to: %d.", doors);
}
SendClientMessage(playerid, COLOR_WHITE, string);
pawn Код:
new VehicleID;
if(!sscanf(params, "d", VehicleID))
{
new engine, lights, alarm, doors, bonnet, boot, objective, string[40];
format(string, sizeof(string), ". : : Vehicle ID %d's params : : .", VehicleID);
GetVehicleParams(VehicleID, engine, lights, alarm, doors, bonnet, boot, objective);
SendClientMesssage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "Engine: %d", engine);
SendClientMesssage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "Lights: %d", lights);
SendClientMesssageM(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "Alarm: %d", alarm);
SendClientMesssage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "Doors: %d", doors);
SendClientMesssage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "Bonnet: %d", bonnet);
SendClientMesssage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "Boot: %d", boot);
SendClientMesssage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "Objective: %d", objective);
SendClientMesssage(playerid, COLOR_WHITE, string);
return 1;
}
else return SendClientMesssage(playerid, COLOR_WHITE, "USAGE: /getvehicleparams [VehicleID]"), 1;
Best regards,
Jesse