30.08.2016, 06:59
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/lock", cmdtext, true, 10) == 0)
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
if(IsPlayerConnected(playerid))
{
new engine,lights,alarm,doors,bonnet,boot,objective;
if(SwitchKey[playerid] == 1)
{
new string[100];
if(personalcar[playerid] != 0)
{
if(CheckPlayerDistanceToVehicle(5.0, playerid, personalcar[playerid]))
{
if(CarInfo[OwnedVeh(personalcar[playerid])][cLock] == 1)
{
GetVehicleParamsEx(personalcar[playerid],engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(personalcar[playerid],engine,lights,alarm,0,bonnet,boot,objective);
format(string, sizeof(string), "~h~%s~n~~g~Unlocked",CarInfo[OwnedVeh(personalcar[playerid])][cDescription]);
GameTextForPlayer(playerid, string, 4000, 4);
CarInfo[OwnedVeh(personalcar[playerid])][cLock] = 0;
gCarLock[personalcar[playerid]] = 0;
vUpdate(OwnedVeh(personalcar[playerid]), cLockx); //
return 1;
}
else if(CarInfo[OwnedVeh(personalcar[playerid])][cLock] == 0)
{
GetVehicleParamsEx(personalcar[playerid],engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(personalcar[playerid],engine,lights,alarm,1,bonnet,boot,objective);
format(string, sizeof(string), "~h~%s~n~~r~Locked",CarInfo[OwnedVeh(personalcar[playerid])][cDescription]);
GameTextForPlayer(playerid, string, 4000, 4);
CarInfo[OwnedVeh(personalcar[playerid])][cLock] = 1;
gCarLock[personalcar[playerid]] = 1;
vUpdate(OwnedVeh(personalcar[playerid]), cLockx); //
return 1;
}
}
else return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Your vehicle not near you.");
}
else return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}You don't have a vehicle.");
}
else if(SwitchKey[playerid] == 2)
{
new carid,string[128];
if(HireCar[playerid] == -1) return SCM(playerid,COLOR_WHITE,"{FFB870}You do not have a rental car/boat/bike/scooter already.");
if(HireCar[playerid] != -1)
{
carid = HireCar[playerid];
}
if(CheckPlayerDistanceToVehicle(5.0, playerid, HireCar[playerid]))
{
if(gCarLock[carid] == 0)
{
new vehicles = GetVehicleModel(carid) - 400;
format(string, sizeof(string), "~h~%s~n~~r~Locked", aVehicleNames[vehicles]);
GameTextForPlayer(playerid, string, 4000, 4);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[carid] = 1;
GetVehicleParamsEx(HireCar[playerid],engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(HireCar[playerid],engine,lights,alarm,1,bonnet,boot,objective);
return 1;
}
else if(gCarLock[carid] == 1)
{
new vehicles = GetVehicleModel(carid) - 400;
format(string, sizeof(string), "~h~%s~n~~g~Unlocked", aVehicleNames[vehicles]);
GameTextForPlayer(playerid, string, 4000, 4);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[carid] = 0;
GetVehicleParamsEx(HireCar[playerid],engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(HireCar[playerid],engine,lights,alarm,0,bonnet,boot,objective);
return 1;
}
}
}
}
return 1;
}