16.08.2011, 12:18
Hey , i added new rent cars everything is ok , but i can still start engine without typing /rentcar
if(blahblahblah)
We are not magician. Show us your code, or at least make a check inside your engine command.
pawn Код:
|
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 == 463 || pveh == 462 || pveh == 481 || pveh == 509) { return 1; } if(idcar == 0 || idcar == 0) { return 1; } if(idcar >= 72 && idcar <= 81) { if(HireCar[playerid] != idcar) { return 1; } } if(IsAPlane(idcar)) { return 1; } if(IsAHarvest(idcar)) { return 1; } if(IsADrugHarvest(idcar)) { return 1; } if(IsASweeper(idcar)) { return 1; } if(gEngine[playerid] == 1) { return 1; } new playerveh = GetPlayerVehicleID(playerid); PutPlayerInVehicle(playerid, playerveh, 0); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s keerab vхtit ja ьritab sхidukit kдivitada.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetTimerEx("StartingTheVehicle",3500,0,"i",playerid); GameTextForPlayer(playerid, "~w~Kдivitan mootorit...",3500,3); 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 == 463 || pveh == 462 || pveh == 481 || pveh == 509) { return 1; } if(idcar == 0 || idcar == 0) { return 1; } if(idcar >= 72 && idcar <= 81) { if(HireCar[playerid] != idcar) { return 1; } } if(IsAHarvest(idcar)) { return 1; } if(IsADrugHarvest(idcar)) { return 1; } if(IsAPlane(idcar)) { return 1; } if(IsASweeper(idcar)) { return 1; } engineOn[GetPlayerVehicleID(playerid)] = false; //RemovePlayerFromVehicle(playerid); TogglePlayerControllable(playerid, 0); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s keerab vхtit ja suretab mootori vдlja.", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); gEngine[playerid] = 0; /* new keycar = PlayerInfo[playerid][pPcarkey]; new keycar2 = PlayerInfo[playerid][pPcarkey2]; new keycar3 = PlayerInfo[playerid][pPcarkey3]; if(IsAnOwnableCar(idcar)) { if(keycar == idcar) { for(new i = 0; i < MAX_PLAYERS; i++) { if (IsPlayerConnected(i)) { SetVehicleParamsForPlayer(keycar,i,0,1); } GameTextForPlayer(playerid, "~w~Vehicle~n~~r~Auto-Locked", 10000, 3); CarInfo[keycar][cLock] = 1; } } else if(keycar2 == idcar) { for(new i = 0; i < MAX_PLAYERS; i++) { if (IsPlayerConnected(i)) { SetVehicleParamsForPlayer(keycar2,i,0,1); } GameTextForPlayer(playerid, "~w~Vehicle~n~~r~Auto-Locked", 10000, 3); CarInfo[keycar2][cLock] = 1; } } else if(keycar3 == idcar) { for(new i = 0; i < MAX_PLAYERS; i++) { if (IsPlayerConnected(i)) { SetVehicleParamsForPlayer(keycar3,i,0,1); } GameTextForPlayer(playerid, "~w~Vehicle~n~~r~Auto-Locked", 10000, 3); CarInfo[keycar3][cLock] = 1; } } }*/ return 1; } } } return 1; }
if(strcmp(cmd, "/rentcar", true) == 0) { if(IsPlayerConnected(playerid)) { if(GetPlayerVehicleID(playerid) >= 72 && GetPlayerVehicleID(playerid) <= 81) { new hirefee = HireCost(GetPlayerVehicleID(playerid)); if(SBizzInfo[0][sbProducts] == 0) { GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1); return 1; } if (GetPlayerMoney(playerid) < 500) { SendClientMessage(playerid, COLOR_GRAD2, " Sul pole piisavalt raha !"); return 1; } if(HireCar[playerid] != 299) { gCarLock[HireCar[playerid]] = 0; UnLockCar(HireCar[playerid]); SendClientMessage(playerid, COLOR_GREY, "Sea pead ennem praegu rendil oleva auto rendi lхpetama !"); return 1; } for(new i=0; i<MAX_PLAYERS; i++) { if(HireCar[i] == GetPlayerVehicleID(playerid)) { SendClientMessage(playerid, COLOR_GREY, " Keegi juba rendib seda !"); return 1; } } /*if(PlayerInfo[playerid][pPbiskey] == 1) { GameTextForPlayer(playerid, "~w~No charge for the boss", 5000, 3); TogglePlayerControllable(playerid, 1); return 1; }*/ SafeGivePlayerMoney(playerid,-500); SBizzInfo[0][sbTill] += 500; ExtortionSBiz(0, SBizzInfo[0][sbEntranceCost]); SBizzInfo[0][sbProducts]--; HireCar[playerid] = GetPlayerVehicleID(playerid); OnPropUpdate(); PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); format(string, sizeof(string), "~w~Don't forget to ~r~/lхpetaautorent~n~~g~/lukusta ~w~to lock your car.",hirefee); SendClientMessage(playerid, COLOR_YELLOW2, "You can start the engine up now !"); gEngine[playerid] = 0; engineOn[GetPlayerVehicleID(playerid)] = false; //TogglePlayerControllable(playerid, 1); GameTextForPlayer(playerid, string, 5000, 3); } } return 1; }
if(!strcmp(cmd, "/engine", true))
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
if(HireCar[playerid] != GetPlayerVehicleID(playerid)) return SendClientMessage(playerid,0xFFFFFF,"You're not renting this car.");//This
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 == 463 || pveh == 462 || pveh == 481 || pveh == 509)
{
return 1;
}
if(idcar == 0 || idcar == 0)
{
return 1;
}
if(idcar >= 72 && idcar <= 81)
{
if(HireCar[playerid] != idcar)
{
return 1;
}
}
if(IsAPlane(idcar))
{
return 1;
}
if(IsAHarvest(idcar))
{
return 1;
}
if(IsADrugHarvest(idcar))
{
return 1;
}
if(IsASweeper(idcar))
{
return 1;
}
if(gEngine[playerid] == 1) { return 1; }
new playerveh = GetPlayerVehicleID(playerid);
PutPlayerInVehicle(playerid, playerveh, 0);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s keerab vхtit ja ьritab sхidukit kдivitada.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetTimerEx("StartingTheVehicle",3500,0,"i",playerid);
GameTextForPlayer(playerid, "~w~Kдivitan mootorit...",3500,3);
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 == 463 || pveh == 462 || pveh == 481 || pveh == 509)
{
return 1;
}
if(idcar == 0 || idcar == 0)
{
return 1;
}
if(idcar >= 72 && idcar <= 81)
{
if(HireCar[playerid] != idcar)
{
return 1;
}
}
if(IsAHarvest(idcar))
{
return 1;
}
if(IsADrugHarvest(idcar))
{
return 1;
}
if(IsAPlane(idcar))
{
return 1;
}
if(IsASweeper(idcar))
{
return 1;
}
engineOn[GetPlayerVehicleID(playerid)] = false;
//RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 0);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s keerab vхtit ja suretab mootori vдlja.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
gEngine[playerid] = 0;
/* new keycar = PlayerInfo[playerid][pPcarkey];
new keycar2 = PlayerInfo[playerid][pPcarkey2];
new keycar3 = PlayerInfo[playerid][pPcarkey3];
if(IsAnOwnableCar(idcar))
{
if(keycar == idcar)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(keycar,i,0,1);
}
GameTextForPlayer(playerid, "~w~Vehicle~n~~r~Auto-Locked", 10000, 3);
CarInfo[keycar][cLock] = 1;
}
}
else if(keycar2 == idcar)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(keycar2,i,0,1);
}
GameTextForPlayer(playerid, "~w~Vehicle~n~~r~Auto-Locked", 10000, 3);
CarInfo[keycar2][cLock] = 1;
}
}
else if(keycar3 == idcar)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(keycar3,i,0,1);
}
GameTextForPlayer(playerid, "~w~Vehicle~n~~r~Auto-Locked", 10000, 3);
CarInfo[keycar3][cLock] = 1;
}
}
}*/
return 1;
}
}
}
return 1;
}
if(strcmp(cmd, "/rentcar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(GetPlayerVehicleID(playerid) >= 72 && GetPlayerVehicleID(playerid) <= 81)
{
new hirefee = HireCost(GetPlayerVehicleID(playerid));
if(SBizzInfo[0][sbProducts] == 0)
{
GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1);
return 1;
}
if (GetPlayerMoney(playerid) < 500)
{
SendClientMessage(playerid, COLOR_GRAD2, " Sul pole piisavalt raha !");
return 1;
}
if(HireCar[playerid] != 299)
{
gCarLock[HireCar[playerid]] = 0;
UnLockCar(HireCar[playerid]);
SendClientMessage(playerid, COLOR_GREY, "Sea pead ennem praegu rendil oleva auto rendi lхpetama !");
return 1;
}
for(new i=0; i<MAX_PLAYERS; i++)
{
if(HireCar[i] == GetPlayerVehicleID(playerid))
{
SendClientMessage(playerid, COLOR_GREY, " Keegi juba rendib seda !");
return 1;
}
}
/*if(PlayerInfo[playerid][pPbiskey] == 1)
{
GameTextForPlayer(playerid, "~w~No charge for the boss", 5000, 3);
TogglePlayerControllable(playerid, 1);
return 1;
}*/
SafeGivePlayerMoney(playerid,-500);
SBizzInfo[0][sbTill] += 500;
ExtortionSBiz(0, SBizzInfo[0][sbEntranceCost]);
SBizzInfo[0][sbProducts]--;
HireCar[playerid] = GetPlayerVehicleID(playerid);
OnPropUpdate();
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Don't forget to ~r~/lхpetaautorent~n~~g~/lukusta ~w~to lock your car.",hirefee);
SendClientMessage(playerid, COLOR_YELLOW2, "You can start the engine up now !");
gEngine[playerid] = 0;
engineOn[GetPlayerVehicleID(playerid)] = false;
//TogglePlayerControllable(playerid, 1);
GameTextForPlayer(playerid, string, 5000, 3);
}
}
return 1;
}
Perhaps this code work, IDK if you've already do this with "if(HireCar[playerid] != idcar)" because I have no idea what's that "idcar".
pawn Код:
|