09.12.2014, 16:56
Hey boys i made a engine command but i cant make it example if some one doesnt have the key he cant turn car engine on pls if some one know tell me
Here is the script
Here is the script
PHP код:
COMMAND:engine(playerid, params[])
{
new xr = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
new sender[MAX_STRING];
if(PlayerTemp[playerid][hname]==1) myStrcpy(sender,"Stranger");
else myStrcpy(sender,NameEx(playerid));
if(IsPlayerInAnyVehicle(playerid) && Vehicles[xr][carmodel] == 481 && Vehicles[xr][carmodel] == 509) return SendClientError(playerid, "You are not in any vehicle, or there is no engine implented.");
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientError(playerid, "You are not in any vehicle!");
new State;
State = GetPlayerState(playerid);
if(State!=PLAYER_STATE_DRIVER) return SendClientMessage(playerid,COLOR_GREY,"You are not the driver!");
new stringa[MAX_STRING];
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine == 0)
{
SetVehicleParamsEx(vid, 1, lights, alarm, doors, bonnet, boot, objective);
format(stringa,sizeof(stringa),"%s has turned the engine on.",sender);
NearMessage(playerid,stringa,COLOR_ME2);
PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
TogglePlayerControllable(playerid, true);
}
else
{
SetVehicleParamsEx(vid, 0, lights, alarm, doors, bonnet, boot, objective);
format(stringa,sizeof(stringa),"%s has turned the engine off.",sender);
NearMessage(playerid,stringa,COLOR_ME2);
TogglePlayerControllable(playerid, true);
}
}
return 1;
}