24.08.2013, 15:34
seguindo a logica do dark tenta isto
pawn Код:
if(strcmp(cmd, "/alugarmoto", true) == 0)
{
if(IsPlayerConnected(playerid))
{
for(new i = 0; i < sizeof(rentcar); i++)
{
if(GetPlayerVehicleID(playerid) == rentcar[i]) continue;
}
new hirefee = HireCost(GetPlayerVehicleID(playerid));
if(SBizzInfo[1][sbProducts] == 0)
{
GameTextForPlayer(playerid, "~r~Fora de estoque", 5000, 1);
return 1;
}
if (GetPlayerMoney(playerid) < SBizzInfo[1][sbEntranceCost])
{
SendClientMessage(playerid, COLOR_GRAD2, " Voce nao tem dinheiro !");
return 1;
}
if(HireCar[playerid] != 299)
{
gCarLock[HireCar[playerid]] = 0;
UnLockCar(HireCar[playerid]);
SendClientMessage(playerid, COLOR_GREY, "Vocк precisa desalugar seu carro/moto/barco atual primeiro !");
return 1;
}
for(new i=0; i<MAX_PLAYERS; i++)
{
if(HireCar[i] == GetPlayerVehicleID(playerid))
{
SendClientMessage(playerid, COLOR_GREY, " Alguem alugou esse carro !");
return 1;
}
}
SafeGivePlayerMoney(playerid,-SBizzInfo[1][sbEntranceCost]);
SBizzInfo[1][sbTill] += SBizzInfo[1][sbEntranceCost];
ExtortionSBiz(1, SBizzInfo[1][sbEntranceCost]);
SBizzInfo[1][sbProducts]--;
HireCar[playerid] = GetPlayerVehicleID(playerid);
OnPropUpdate(3,1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_YELLOW2, "Voce pode dar a inginicao !");
gEngine[playerid] = 1;
format(string, sizeof(string), "~w~Nao esqueca de usar ~r~/desalugarmoto~n~~g~/trancar ~w~para fechar o carro.",hirefee);
GameTextForPlayer(playerid, string, 5000, 3);
new engine, lights, alarm, doors, bonnet, boot, objective, y, m, d, h,mi,s;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /alugarmoto",d,m,y,h,mi,s,sendername);
CommandLog(string);
}
return 1;
}