10.07.2011, 13:21
Here is the code.
if(!strcmp(cmd, "/engine", true))
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
if(!engineOn[GetPlayerVehicleID(playerid)])
{
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
return 1;
}
if(IsAnOwnableCar(idcar))
{
if(PlayerInfo[playerid][pPcarkey] == idcar) { }
else if(PlayerInfo[playerid][pPcarkey2] == idcar) { }
else if(PlayerInfo[playerid][pPcarkey3] == idcar) { }
else { return 1; }
}
if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509)
{
return 1;
}
if(idcar == 59 || idcar == 60)
{
return 1;
}
if(idcar >= 135 && idcar <= 154)
{
if(HireCar[playerid] != idcar)
{
return 1;
}
}
if(IsAHarvest(idcar))
{
return 1;
}
if(IsADrugHarvest(idcar))
{
return 1;
}
if(IsASweeper(idcar))
{
return 1;
}
if(gEngine[playerid] == 1) { return 1; }
PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid), 0);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s pagrieћ atslēgu un mēģina pielaist maљīnas motoru.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
SetTimerEx("StartingTheVehicle",3500,0,"i",playeri d);
GetVehicleParamsEx(GetPlayerVehicleID(playerid),en gine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid),0, lights,alarm,doors,bonnet,boot,objective);
GameTextForPlayer(playerid, "~w~Iedarbina motoru...",3500,3);
SetPlayerChatBubble(playerid, string, COLOR_PURPLE, 13.0, 5000);
gEngine[playerid] = 1;
return 1;
}
if(engineOn[GetPlayerVehicleID(playerid)])
{
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
return 1;
}
if(IsAnOwnableCar(idcar))
{
if(PlayerInfo[playerid][pPcarkey] == idcar) { }
else if(PlayerInfo[playerid][pPcarkey2] == idcar) { }
else if(PlayerInfo[playerid][pPcarkey3] == idcar) { }
else { return 1; }
}
if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509)
{
return 1;
}
if(idcar == 59 || idcar == 60)
{
return 1;
}
if(idcar >= 135 && idcar <= 154)
{
if(HireCar[playerid] != idcar)
{
return 1;
}
}
if(IsAHarvest(idcar))
{
return 1;
}
if(IsADrugHarvest(idcar))
{
return 1;
}
if(IsASweeper(idcar))
{
return 1;
}
engineOn[GetPlayerVehicleID(playerid)] = false;
//RemovePlayerFromVehicle(playerid);
GetVehicleParamsEx(GetPlayerVehicleID(playerid),en gine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid),0, lights,alarm,doors,bonnet,boot,objective);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s pagrieћ atslēgu un izslēdz maљīnas motoru.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
SetPlayerChatBubble(playerid, string, COLOR_PURPLE, 13.0, 5000);
gEngine[playerid] = 0;
return 1;
}
}
}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(gTeam[playerid] >= 1||gTeam[playerid] >= 3||gTeam[playerid] >= 4)
{
if (IsACopCar(vehicleid) && !ispassenger)
{
if(PlayerInfo[playerid][pLeader]==1||PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pLeader]==3||PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pMember]==2||PlayerInfo[playerid][pMember]==3) {}
else {
ApplyAnimation(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
new Float:cx, Float:cy, Float:cz;
GetPlayerPos(playerid, cx, cy, cz);
SetPlayerPos(playerid, cx, cy, cz);
}
}
if (IsAMatCar(vehicleid) && !ispassenger)
{
if(PlayerInfo[playerid][pJob] == 22) {}
else {
ApplyAnimation(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
new Float:cx, Float:cy, Float:cz;
GetPlayerPos(playerid, cx, cy, cz);
SetPlayerPos(playerid, cx, cy, cz);
}
}
if (IsNgCar(vehicleid) && !ispassenger)
{
if(PlayerInfo[playerid][pLeader]==1||PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pLeader]==3||PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pMember]==2||PlayerInfo[playerid][pMember]==3) {}
else {
ApplyAnimation(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
new Float:cx, Float:cy, Float:cz;
GetPlayerPos(playerid, cx, cy, cz);
SetPlayerPos(playerid, cx, cy, cz);
}
}
if (IsATank(vehicleid) && !ispassenger)
{
if(PlayerInfo[playerid][pLeader]==1||PlayerInfo[playerid][pLeader]==3||PlayerInfo[playerid][pMember]==3) {}
else { WantedPoints[playerid]+=2; SetPlayerCriminal(playerid,255, "Zog tanku"); SendClientMessage(playerid, COLOR_GREY,"You don't know how to drive it yet."); }
}
if(IsAnOwnableCar(vehicleid) && CarInfo[vehicleid][cLock] == 1 && CarInfo[vehicleid][cOwned] == 1)
{
if(PlayerInfo[playerid][pAdmin] >= 1337 && AdminDuty[playerid] == 1) { }
else
{
}
}
}
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
new string[128];
new sendername[MAX_PLAYER_NAME];
if (GetPlayerState(playerid) == 1)
{
return 1;
}
if(IsAHarvest(vehicleid))
{
if(FarmerVar[playerid] == 1)
{
SetTimer("FarmerExit", 7000, 0);
GameTextForPlayer(playerid, "~n~~w~Tev ir ~r~7~w~ sekundes~n~lai iekaptu atpakal kombaina", 5000, 3);
}
}
if(IsADrugHarvest(vehicleid))
{
if(DrugFarmerVar[playerid] == 1)
{
SetTimer("DrugFarmerExit", 7000, 0);
GameTextForPlayer(playerid, "~n~~w~Tev ir ~r~7~w~ sekundes~n~lai iekaptu atpakal kombaina", 5000, 3);
}
}
if(IsASmuggleCar(vehicleid))
{
if(SmugglerWork[playerid] == 1)
{
SetTimer("SmugglerExit", 7000, 0);
GameTextForPlayer(playerid, "~n~~w~Tev ir ~r~7~w~ sekundes~n~lai iekaptu atpakal auto", 5000, 3);
}
}
if(!engineOn[GetPlayerVehicleID(playerid)])
{
if(Piespradzejies[playerid] == 1)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s ātri nospieћ pogu un atsprādzējas", sendername);
ProxDetector(15.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
Piespradzejies[playerid] = 0;
}
}
else
{
if(Piespradzejies[playerid] == 1)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s ātri nospieћ pogu un atsprādzējas", sendername);
ProxDetector(15.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
Piespradzejies[playerid] = 0;
}
}
if(gGas[playerid] == 1)
{
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~Pame ti auto", 500, 3);
}
if (BusrouteEast[playerid][0] != 0)
{
BusrouteEnd(playerid, vehicleid);
}
if (IsABus(vehicleid))
{
foreach(Player, i)
{
if (BusrouteEast[i][0] != 0 && BusrouteEast[i][1] == vehicleid)
{
GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~g~Pasazieris izkapa", 5000, 3);
}
}
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new string[128];
new sendername[MAX_PLAYER_NAME];
new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
new newcar = GetPlayerVehicleID(playerid);
if(newkeys == KEY_JUMP)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInAnyVehicle(i))
{
if(IsPlayerConnected(i))
{
if(!engineOn[GetPlayerVehicleID(i)])
{
if(GetPlayerState(i) == PLAYER_STATE_PASSENGER)
{
return 1;
}
if(IsAnOwnableCar(newcar))
{
if(PlayerInfo[playerid][pPcarkey] == newcar) { }
else if(PlayerInfo[playerid][pPcarkey2] == newcar) { }
else if(PlayerInfo[playerid][pPcarkey3] == newcar) { }
else if(PlayerInfo[playerid][pDublicateKey1] == newcar) { }
else if(PlayerInfo[playerid][pDublicateKey2] == newcar) { }
else { return 1; }
}
if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509)
{
return 1;
}
if(newcar == 59 || newcar == 60)
{
return 1;
}
if(newcar >= 135 && newcar <= 154)
{
if(HireCar[playerid] != newcar)
{
return 1;
}
}
if(IsAHarvest(newcar))
{
return 1;
}
if(IsADrugHarvest(newcar))
{
return 1;
}
if(IsASweeper(newcar))
{
return 1;
}
if(gEngine[playerid] == 1) { return 1; }
// new playerveh = GetPlayerVehicleID(playerid);
PutPlayerInVehicle(playerid, newcar, 0);
GetPlayerName(playerid, sendername, sizeof(sendername));
sendername[strfind(sendername, "_")] = ' ';
format(string, sizeof(string), "* %s pagrieћ atslēgu un mēģina pielaist maљīnas motoru.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
SetTimerEx("StartingTheVehicle",3500,0,"i",playeri d);
GameTextForPlayer(playerid, "~w~Iedarbina motoru...",3500,3);
gEngine[playerid] = 1;
return 1;
}
}
}
}
}
So help me know plzz
if(!strcmp(cmd, "/engine", true))
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
if(!engineOn[GetPlayerVehicleID(playerid)])
{
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
return 1;
}
if(IsAnOwnableCar(idcar))
{
if(PlayerInfo[playerid][pPcarkey] == idcar) { }
else if(PlayerInfo[playerid][pPcarkey2] == idcar) { }
else if(PlayerInfo[playerid][pPcarkey3] == idcar) { }
else { return 1; }
}
if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509)
{
return 1;
}
if(idcar == 59 || idcar == 60)
{
return 1;
}
if(idcar >= 135 && idcar <= 154)
{
if(HireCar[playerid] != idcar)
{
return 1;
}
}
if(IsAHarvest(idcar))
{
return 1;
}
if(IsADrugHarvest(idcar))
{
return 1;
}
if(IsASweeper(idcar))
{
return 1;
}
if(gEngine[playerid] == 1) { return 1; }
PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid), 0);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s pagrieћ atslēgu un mēģina pielaist maљīnas motoru.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
SetTimerEx("StartingTheVehicle",3500,0,"i",playeri d);
GetVehicleParamsEx(GetPlayerVehicleID(playerid),en gine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid),0, lights,alarm,doors,bonnet,boot,objective);
GameTextForPlayer(playerid, "~w~Iedarbina motoru...",3500,3);
SetPlayerChatBubble(playerid, string, COLOR_PURPLE, 13.0, 5000);
gEngine[playerid] = 1;
return 1;
}
if(engineOn[GetPlayerVehicleID(playerid)])
{
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
return 1;
}
if(IsAnOwnableCar(idcar))
{
if(PlayerInfo[playerid][pPcarkey] == idcar) { }
else if(PlayerInfo[playerid][pPcarkey2] == idcar) { }
else if(PlayerInfo[playerid][pPcarkey3] == idcar) { }
else { return 1; }
}
if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509)
{
return 1;
}
if(idcar == 59 || idcar == 60)
{
return 1;
}
if(idcar >= 135 && idcar <= 154)
{
if(HireCar[playerid] != idcar)
{
return 1;
}
}
if(IsAHarvest(idcar))
{
return 1;
}
if(IsADrugHarvest(idcar))
{
return 1;
}
if(IsASweeper(idcar))
{
return 1;
}
engineOn[GetPlayerVehicleID(playerid)] = false;
//RemovePlayerFromVehicle(playerid);
GetVehicleParamsEx(GetPlayerVehicleID(playerid),en gine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid),0, lights,alarm,doors,bonnet,boot,objective);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s pagrieћ atslēgu un izslēdz maљīnas motoru.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
SetPlayerChatBubble(playerid, string, COLOR_PURPLE, 13.0, 5000);
gEngine[playerid] = 0;
return 1;
}
}
}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(gTeam[playerid] >= 1||gTeam[playerid] >= 3||gTeam[playerid] >= 4)
{
if (IsACopCar(vehicleid) && !ispassenger)
{
if(PlayerInfo[playerid][pLeader]==1||PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pLeader]==3||PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pMember]==2||PlayerInfo[playerid][pMember]==3) {}
else {
ApplyAnimation(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
new Float:cx, Float:cy, Float:cz;
GetPlayerPos(playerid, cx, cy, cz);
SetPlayerPos(playerid, cx, cy, cz);
}
}
if (IsAMatCar(vehicleid) && !ispassenger)
{
if(PlayerInfo[playerid][pJob] == 22) {}
else {
ApplyAnimation(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
new Float:cx, Float:cy, Float:cz;
GetPlayerPos(playerid, cx, cy, cz);
SetPlayerPos(playerid, cx, cy, cz);
}
}
if (IsNgCar(vehicleid) && !ispassenger)
{
if(PlayerInfo[playerid][pLeader]==1||PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pLeader]==3||PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pMember]==2||PlayerInfo[playerid][pMember]==3) {}
else {
ApplyAnimation(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
new Float:cx, Float:cy, Float:cz;
GetPlayerPos(playerid, cx, cy, cz);
SetPlayerPos(playerid, cx, cy, cz);
}
}
if (IsATank(vehicleid) && !ispassenger)
{
if(PlayerInfo[playerid][pLeader]==1||PlayerInfo[playerid][pLeader]==3||PlayerInfo[playerid][pMember]==3) {}
else { WantedPoints[playerid]+=2; SetPlayerCriminal(playerid,255, "Zog tanku"); SendClientMessage(playerid, COLOR_GREY,"You don't know how to drive it yet."); }
}
if(IsAnOwnableCar(vehicleid) && CarInfo[vehicleid][cLock] == 1 && CarInfo[vehicleid][cOwned] == 1)
{
if(PlayerInfo[playerid][pAdmin] >= 1337 && AdminDuty[playerid] == 1) { }
else
{
}
}
}
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
new string[128];
new sendername[MAX_PLAYER_NAME];
if (GetPlayerState(playerid) == 1)
{
return 1;
}
if(IsAHarvest(vehicleid))
{
if(FarmerVar[playerid] == 1)
{
SetTimer("FarmerExit", 7000, 0);
GameTextForPlayer(playerid, "~n~~w~Tev ir ~r~7~w~ sekundes~n~lai iekaptu atpakal kombaina", 5000, 3);
}
}
if(IsADrugHarvest(vehicleid))
{
if(DrugFarmerVar[playerid] == 1)
{
SetTimer("DrugFarmerExit", 7000, 0);
GameTextForPlayer(playerid, "~n~~w~Tev ir ~r~7~w~ sekundes~n~lai iekaptu atpakal kombaina", 5000, 3);
}
}
if(IsASmuggleCar(vehicleid))
{
if(SmugglerWork[playerid] == 1)
{
SetTimer("SmugglerExit", 7000, 0);
GameTextForPlayer(playerid, "~n~~w~Tev ir ~r~7~w~ sekundes~n~lai iekaptu atpakal auto", 5000, 3);
}
}
if(!engineOn[GetPlayerVehicleID(playerid)])
{
if(Piespradzejies[playerid] == 1)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s ātri nospieћ pogu un atsprādzējas", sendername);
ProxDetector(15.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
Piespradzejies[playerid] = 0;
}
}
else
{
if(Piespradzejies[playerid] == 1)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s ātri nospieћ pogu un atsprādzējas", sendername);
ProxDetector(15.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
Piespradzejies[playerid] = 0;
}
}
if(gGas[playerid] == 1)
{
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~Pame ti auto", 500, 3);
}
if (BusrouteEast[playerid][0] != 0)
{
BusrouteEnd(playerid, vehicleid);
}
if (IsABus(vehicleid))
{
foreach(Player, i)
{
if (BusrouteEast[i][0] != 0 && BusrouteEast[i][1] == vehicleid)
{
GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~g~Pasazieris izkapa", 5000, 3);
}
}
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new string[128];
new sendername[MAX_PLAYER_NAME];
new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
new newcar = GetPlayerVehicleID(playerid);
if(newkeys == KEY_JUMP)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInAnyVehicle(i))
{
if(IsPlayerConnected(i))
{
if(!engineOn[GetPlayerVehicleID(i)])
{
if(GetPlayerState(i) == PLAYER_STATE_PASSENGER)
{
return 1;
}
if(IsAnOwnableCar(newcar))
{
if(PlayerInfo[playerid][pPcarkey] == newcar) { }
else if(PlayerInfo[playerid][pPcarkey2] == newcar) { }
else if(PlayerInfo[playerid][pPcarkey3] == newcar) { }
else if(PlayerInfo[playerid][pDublicateKey1] == newcar) { }
else if(PlayerInfo[playerid][pDublicateKey2] == newcar) { }
else { return 1; }
}
if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509)
{
return 1;
}
if(newcar == 59 || newcar == 60)
{
return 1;
}
if(newcar >= 135 && newcar <= 154)
{
if(HireCar[playerid] != newcar)
{
return 1;
}
}
if(IsAHarvest(newcar))
{
return 1;
}
if(IsADrugHarvest(newcar))
{
return 1;
}
if(IsASweeper(newcar))
{
return 1;
}
if(gEngine[playerid] == 1) { return 1; }
// new playerveh = GetPlayerVehicleID(playerid);
PutPlayerInVehicle(playerid, newcar, 0);
GetPlayerName(playerid, sendername, sizeof(sendername));
sendername[strfind(sendername, "_")] = ' ';
format(string, sizeof(string), "* %s pagrieћ atslēgu un mēģina pielaist maљīnas motoru.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
SetTimerEx("StartingTheVehicle",3500,0,"i",playeri d);
GameTextForPlayer(playerid, "~w~Iedarbina motoru...",3500,3);
gEngine[playerid] = 1;
return 1;
}
}
}
}
}
So help me know plzz