Car Problem Close and start - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Car Problem Close and start (
/showthread.php?tid=212242)
Car Problem Close and start -
SanAndreasVille - 16.01.2011
Hi i have a problem with my script
Код:
new Lock[MAX_VEHICLES];
#define COLOR_GREEN 0x33AA33AA
if(!strcmp(cmdtext,"/lock"))
{
new Float:VX,Float:VY,Float:VZ;
for(new vehicleid=1;vehicleid<MAX_VEHICLES;vehicleid++)
{
GetVehiclePos(vehicleid,VX,VY,VZ);
if(!IsPlayerInRangeOfPoint(playerid,2.5,VX,VY,VZ))continue;
if(Lock[vehicleid] == 0)
{
Lock[vehicleid] = 1;
SendClientMessage(playerid,COLOR_GREEN,"Car closed");
break;
}
if(Lock[vehicleid] == 1)
{
Lock[vehicleid] = 0;
SendClientMessage(playerid,COLOR_GREEN,"Car open");
break;
}
}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(Lock[vehicleid] == 1)
{
ClearAnimations(playerid);
SendClientMessage(playerid,COLOR_GREEN,"Car is closed");
return 1;
}
return 1;
}
i want when i leave the car the door automatic open is can everyone help me ?
Код:
if(strcmp(cmdtext, "/engine",true) == 0) {
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1;
new engine,lights,alarm,doors,bonnet,boot,objective;
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
if(vid != INVALID_VEHICLE_ID) {
if(engine == VEHICLE_PARAMS_ON)
{
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid,0x828282FF, " stop engine...");
}
else
{
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid,0x828282FF, " start engine...");
}
}
return 1;
}
i want here a timer of 3seconds bevor i can drive wehn i type /engine
I hope everyone can help me thanks!
Re: Car Problem Close and start -
admantis - 16.01.2011
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if (Lock[vehicleid] == 1)
{
new state = GetPlayerState(playerid);
if (state == PLAYER_STATE_DRIVER)
{
Lock[vehicleid] = 0;
//SendClientMessage(playerid,0xFFFFFF,"Your vehicle has been automatically unlocked.");
}
}
}
Edited.
Re: Car Problem Close and start -
SanAndreasVille - 16.01.2011
thanks it works !
can everyone help me with the timer when i start the engine 3seconds wait too drive