22.01.2015, 17:59
PHP код:
COMMAND:mootor(playerid, params[])
{
new string[128];
if(PlayerLoggedIn[playerid] == true)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(!IsABike(vehicleid))
{
if(Mootor[vehicleid] == 0)
{
if(IsAnyFactionVehicle(vehicleid))
{
if(IsFactionVehicle(vehicleid, KasutajaInfo[playerid][Grupeering]))
{
if(K2ivitabMootorit[playerid] == 0)
{
format(string, sizeof(string), "* %s kдivitab sхiduki mootori.", RPN(playerid));
SendEmotion(playerid, string);
SetTimerEx("StartVehicleEngine", 1500, false, "i i", playerid, vehicleid);
K2ivitabMootorit[playerid] = 1;
}
else SendClientMessage(playerid, COLOR_WHITE, "Palun oota ennem jдrgmise mootori kaivitamist");
}
else SendClientMessage(playerid, COLOR_RED, "See pole sinu masin!");
}
else if(IsAnyJobVehicle(vehicleid))
{
if(IsJobVehicle(vehicleid, KasutajaInfo[playerid][Tookoht]))
{
if(K2ivitabMootorit[playerid] == 0)
{
format(string, sizeof(string), "* %s kдivitab sхiduki mootori.", RPN(playerid));
SendEmotion(playerid, string);
SetTimerEx("StartVehicleEngine", 1500, false, "i i", playerid, vehicleid);
K2ivitabMootorit[playerid] = 1;
}
else SendClientMessage(playerid, COLOR_WHITE, "Palun oota ennem jдrgmise mootori kaivitamist");
}
else SendClientMessage(playerid, COLOR_RED, "See pole sinu masin!");
}
else if(!IsAnyFactionVehicle(vehicleid) && !IsAnyJobVehicle(vehicleid))
{
if(MasinaInfo[vehicleid-FraksiMasinaidKokku][MasinOlemas] == 1)
{
if(!strcmp(MasinaInfo[vehicleid-FraksiMasinaidKokku][Omanik], RPNU(playerid), true))
{
if(K2ivitabMootorit[playerid] == 0)
{
format(string, sizeof(string), "* %s kдivitab sхiduki mootor.", RPN(playerid));
SendEmotion(playerid, string);
SetTimerEx("StartVehicleEngine", 1500, false, "i i", playerid, vehicleid);
K2ivitabMootorit[playerid] = 1;
}
else SendClientMessage(playerid, COLOR_WHITE, "Palun oota ennem jдrgmise mootori kaivitamist");
}
/*else if(!strcmp(MasinaInfo[vehicleid-FraksiMasinaidKokku][VaruOmanik], RPNU(playerid), true))
{
if(K2ivitabMootorit[playerid] == 0)
{
format(string, sizeof(string), "* %s keerab oma masina varuvхtit ja ьritab kдivitada masina mootorit.", RPN(playerid));
SendEmotion(playerid, string);
SetTimerEx("StartVehicleEngine", 1500, false, "i i", playerid, vehicleid);
K2ivitabMootorit[playerid] = 1;
}
else SendClientMessage(playerid, COLOR_GREY, "Palun oota ennem jдrgmise mootori kдivitamist!");
}*/
else SendClientMessage(playerid, COLOR_RED, "See pole sinu masin!");
}
}
}
else if(Mootor[vehicleid] == 1)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
Mootor[vehicleid] = 0;
format(string, sizeof(string), "* %s suretab sхiduki mootori.", RPN(playerid));
SendEmotion(playerid, string);
SetVehicleParamsEx(vehicleid, false, lights, alarm, doors, bonnet, boot, objective);
}
}
else SendClientMessage(playerid, COLOR_WHITE, "VIGA: Jalgratastel pole mootorit");
}
else SendClientMessage(playerid, COLOR_WHITE, "VIGA: Sa ei ole masina juht");
}
else SendClientMessage(playerid, COLOR_WHITE, "VIGA: Sa pead olema mingis masinas");
}
else SendClientMessage(playerid, COLOR_WHITE, "VIGA: Sa ei ole veel sisse loginud");
return 1;
}