Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(IsPlayerNPC(playerid)) return 1;
if(playerDB[playerid][vedelogin] == false){SendClientMessage(playerid,GREY,"* Sistema: Pirmiausia prisijunkite"); return 1;}
if(vehicleDB[vehicleid][locked] && !playerDB[playerid][bypass])
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
if(strcmp(name,vehicleDB[vehicleid][owner_name],true))
{
if(vehicleDB[vehicleid][signalizacija] == 1)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, engine, lights, 1, doors, bonnet, boot, objective);
SetTimerEx("Signalizacija", 30000, false, "d", vehicleid);
}
new msg[128];
format(msg,sizeof(msg),"Masina yra uzrakinta. Ji priklauso %s",vehicleDB[vehicleid][owner_name]);
SendClientMessage(playerid,COLOR,msg);
Stop(playerid);
return 1;
}
}
GetVehiclePos(vehicleid,vehicleDB[vehicleid][lastpos][0],vehicleDB[vehicleid][lastpos][1],vehicleDB[vehicleid][lastpos][2]);
GetVehicleZAngle(vehicleid,vehicleDB[vehicleid][lastpos][3]);
if(playerDB[playerid][vedelogin] == false){SendClientMessage(playerid,GREY,"* Sistema: Pirmiausia prisijunkite"); return 1;}
new Float:x, Float:y, Float:z;
GetVehiclePos(vehicleid, x, y, z);
if(GetVehicleModel(vehicleid) == 405)
{
if(GetPlayerMoneyA(playerid) < 300)
{
SendClientMessage(playerid, RED, "* Nuoma: Nuomos kaina 300lt Dėja, jūs љiuo metu neturite tiek.");
Stop(playerid);
return 1;
}
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
ShowPlayerDialog(playerid, 45, DIALOG_STYLE_MSGBOX, "{00B0F5}* Nuoma *", "{D5FF00}Ar norite iљsinuomoti maљiną?{00FF51} Kaina - 300Lt", "Taip", "Ne");
return 1;
}
}
if(GetVehicleModel(vehicleid) == 468)
{
if(playerDB[playerid][nuomam])
{
SendClientMessage(playerid,GREY,"Sphagnum: Jūs dar turite galiojanti nuomos čeki..");
return 1;
}
if(GetPlayerMoneyA(playerid) < 400)
{
SendClientMessage(playerid, RED, "* Motoklubas SPHAGNUM: Motociklų nuomos kainą treniruotei: 400LT Dėja jūs tiek neturite.");
Stop(playerid);
return 1;
}
if(!playerDB[playerid][nuomam])
{
ShowPlayerDialog(playerid, 53, DIALOG_STYLE_MSGBOX, "{0059FF}* Motoklubas SPHAGNUM *", "{FFBB00}Ar norite iљsinuomoti krosini motociklą?{00FF55} Kaina - 300Lt", "Taip", "Ne");}
return 1;
}
if(GetVehicleModel(vehicleid) == 471)
{
if(playerDB[playerid][nuomak])
{
SendClientMessage(playerid,GREY,"Sphagnum: Jūs dar turite galiojanti nuomos čeki..");
return 1;
}
if(GetPlayerMoneyA(playerid) < 400)
{
SendClientMessage(playerid, RED, "* Motoklubas SPHAGNUM: Motociklų nuomos kainą treniruotei: ~g~400LT ~b~ Dėja jūs tiek neturite.");
Stop(playerid);
return 1;
}
if(!playerDB[playerid][nuomak])
{
ShowPlayerDialog(playerid, 54, DIALOG_STYLE_MSGBOX, "*{0059FF} Motoklubas SPHAGNUM *", "{FFBB00}Ar norite iљsinuomoti krosini keturrati?{00FF55} Kaina - 300Lt", "Taip", "Ne");}
return 1;
}
new model = GetVehicleModel(vehicleid);
if(playerDB[playerid][ikalintas] == true){SetPlayerHealth(playerid, 0); return 1;}
if(ispassenger)
{
if(model == SHAMAL)
{
playerDB[playerid][lektuvas]=vehicleid;
SetPlayerInterior(playerid,1);
SetPlayerPos(playerid,2.384830,33.103397,1199.849976);
SetPlayerVirtualWorld(playerid,vehicleid);
}
return 1;
}
//Ilipo vairuotojas
playerDB[playerid][masina]=vehicleid;
vehicleDB[vehicleid][lastuser]=playerid;
playerDB[playerid][motociklas]=vehicleid;
motoDB[vehicleid][lastuser]=playerid;
new Float:Coo[3];
GetVehiclePos(vehicleid,Coo[0],Coo[1],Coo[2]);
return 1;
}