01.02.2012, 04:13
I am trying to make it so that once a player enters a game all the vehicles engine's will be shut off and will not turn on until someone goes into the car and types "/key".
These are my variables. (Top of my script.)
This is my OnPlayerUpdate part.
and this is my /key command [zcmd]
I have no errors when I compile, but when I get in the car and type /key the engine only turns on for about half a second. Then shuts off. Can someone tell me what I'm doing wrong? I've ******d all over the place, and have spent a lot of time trying to figure it out but to no avail. Thank you.
These are my variables. (Top of my script.)
pawn Код:
new iengine,ilights, ialarm, idoors,iboot, ibonnet, iobjective;
pawn Код:
public OnPlayerUpdate(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
new VID = GetPlayerVehicleID(playerid)
switch(VID)
{
case 1 .. 100:
{
GetVehicleParamsEx(VID,iengine,ilights, ialarm, idoors,iboot, ibonnet, iobjective);
SetVehicleParamsEx(VID,0,ilights,ialarm,idoors,iboot,ibonnet,iobjective);
return 1;
}
}
}
return 1;
}
pawn Код:
CMD:key(playerid,params[])
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,iengine,ilights,ialarm,idoors,iboot,ibonnet,iobjective);
if(IsPlayerInAnyVehicle(playerid))
{
if(iengine == 0)
{
SendClientMessage(playerid,COLOR_WHITE,"Vehicle started.");
SetVehicleParamsEx(vid,1,ilights,ialarm,idoors,ibonnet,iboot,iobjective);
return 1;
}
else if(iengine == 1)
{
SendClientMessage(playerid,COLOR_WHITE,"Vehicle started.");
SetVehicleParamsEx(vid,0,ilights,ialarm,idoors,ibonnet,iboot,iobjective);
return 1;
}
}
return 1;
}