24.05.2014, 01:06
I want to be more Realistic for my Roleplay server , where you can't just Open the Engine even the car is not yours and you don't have the keys for it which is unrealistic i want to have like you need to Hotwire it before it opens using Hotwire that buyable from 24/7 this is my Codes
MY CODES
Other Codes, but when i usei will have 20-30 errors , i can add the Variables but other i don't know
I need help please
MY CODES
pawn Код:
CMD:engine(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid, string[128];
vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine == VEHICLE_PARAMS_ON)
{
SetVehicleEngine(vehicleid, playerid);
}
else if((engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET))
{
SetTimerEx("SetVehicleEngine", 2000, 0, "dd", vehicleid, playerid);
if(PlayerInfo[playerid][pMask] == 1) { format(string, sizeof(string), "Stranger has successfully started their Vehicle engine"); }
else { format(string, sizeof(string), "* %s has successfully started their Vehicle engine", GetPlayerNameEx(playerid)); }
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
return 1;
}
pawn Код:
CMD:car(playerid, params[])
{
if(isnull(params))
{
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /car [name]");
SendClientMessageEx(playerid, COLOR_GREY, "Available names: Status, Engine, Lights, Trunk, Hood");
return 1;
}
if(strcmp(params, "engine", true) == 0 && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new engine,lights,alarm,doors,bonnet,boot,objective,vehicleid, string[128];
vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine == VEHICLE_PARAMS_ON)
{
format(string, sizeof(string), "* %s twists the key in the ignition, turning the engine off.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetVehicleEngine(vehicleid, playerid);
}
else if((engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET))
{
if(Gas[vehicleid] < 1.0)
{
SendClientMessageEx(playerid, COLOR_GRAD2, " Your vehicle is out of fuel, it won't start!");
}
if(BaitDisabled[vehicleid] == 1)
{
SendClientMessageEx(playerid, COLOR_GRAD2, " Your vehicle ignition switch appears to not be working correctly!");
}
else
{
foreach(Player, i)
{
for(new d=0; d<MAX_PLAYERVEHICLES; d++)
{
if(PlayerVehicleInfo[i][d][pvId] == vehicleid)
{
if(i == playerid)
{
if(!IsABike(vehicleid))
{
SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine starting, please wait...");
SetTimerEx("SetVehicleEngine", 1000, 0, "dd", vehicleid, playerid);
format(string, sizeof(string), "* %s twists the key in the ignition, turning the engine on.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine starting, please wait...");
SetTimerEx("SetVehicleEngine", 700, 0, "dd", vehicleid, playerid);
format(string, sizeof(string), "* %s flips the killswitch to the on position and depresses the ignition switch, turning the engine on.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
}
else if(i == PlayerInfo[playerid][pVehicleKeysFrom])
{
if(!IsABike(vehicleid))
{
SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine starting, please wait...");
SetTimerEx("SetVehicleEngine", 1000, 0, "dd", vehicleid, playerid);
format(string, sizeof(string), "* %s twists the key in the ignition, turning the engine on.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine starting, please wait...");
SetTimerEx("SetVehicleEngine", 700, 0, "dd", vehicleid, playerid);
format(string, sizeof(string), "* %s flips the killswitch to the on position and depresses the ignition switch, turning the engine on.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
}
else
{
if(PlayerInfo[playerid][pHasCarJack] == 1)
{
if(PlayerInfo[playerid][pJackingCar] == 1)
{
SendClientMessageEx(playerid, COLOR_GRAD2, " You are already attempting to jack the car, please wait!");
return 1;
}
else
{
format(string, sizeof(string), "* %s takes out a set of tools and attempts to wire the ignition.", GetPlayerNameEx(playerid));
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SendClientMessageEx(playerid, COLOR_WHITE, "Attempting to wire the ignition...");
GameTextForPlayer(playerid, "~r~Attempting to wire the ignition...", 10000, 3);
SetTimerEx("WireIgnition", 10000, 0, "id", playerid, vehicleid);
PlayerInfo[playerid][pJackingCar] =1;
PlayerInfo[playerid][pJackAttempts] --;
if(PlayerInfo[playerid][pJackAttempts] == 0)
{
PlayerInfo[playerid][pHasCarJack] =0;
SendClientMessageEx(playerid, COLOR_WHITE, "This is your last attempt, the tool kit has worn down...");
}
return 1;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD2, " You do not have the keys for this vehicle / any car jacking items to start the ignition!");
return 1;
}
}
}
}
}
I need help please