01.10.2018, 22:38
PlayerCommands
DefCars
Dialogs
GameMode
PHP код:
COMMAND:carros(playerid, params[])
{
if (APlayerData[playerid][LoggedIn] == true)
{
if (APlayerData[playerid][PlayerLevel] >= 1)
{
if (GetPlayerVehicleID(playerid) == 0)
CarList_Create(playerid);
}
else
return 0;
}
else
return 0;
return 1;
}
PHP код:
CarList_Create(playerid)
{
new Counter, CarList[500], DialogTitle[128];
for (new i = APlayerData[playerid][DialogCarFirstCar]; i < sizeof(ACars); i++)
{
Counter++;
if (Counter <= 10)
{
if (strlen(CarList) == 0)
format(CarList, 500, "%s", ACars[i][CarName]);
else
format(CarList, 500, "%s%s%s", CarList, "\n", ACars[i][CarName]);
}
else
{
format(CarList, 500, "%s%s%s", CarList, "\n \n", TXT_DialogEntryNext);
break;
}
}
format(DialogTitle, 128, TXT_DialogCarTitle, (APlayerData[playerid][DialogCarFirstCar] / 10) + 1);
ShowPlayerDialog(playerid, DialogCar, DIALOG_STYLE_LIST, DialogTitle, CarList, TXT_DialogButtonSpawn, TXT_DialogButtonCancel);
return 1;
}
PHP код:
Dialog_Car(playerid, response, listitem)
{
if(!response)
{
APlayerData[playerid][DialogCarFirstCar] = 0;
return 1;
}
switch (listitem)
{
case 10:
{
CarList_Create(playerid);
return 1;
}
case 11:
{
APlayerData[playerid][DialogCarFirstCar] = APlayerData[playerid][DialogCarFirstCar] + 10;
CarList_Create(playerid);
}
default:
{
new Float:x, Float:y, Float:z, Float:rot, CarIndex, msg[128], vID;
new engine,lights,alarm,doors,bonnet,boot,objective;
CarIndex = APlayerData[playerid][DialogCarFirstCar] + listitem;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, rot);
vID = Vehicle_Create(ACars[CarIndex][CarModel], x, y, z, rot, random(126), random(126), 600);
PutPlayerInVehicle(playerid, vID, 0);
GetVehicleParamsEx(vID, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vID, 1, 1, alarm, doors, bonnet, boot, objective);
GetPlayerPos(playerid, APlayerData[playerid][PreviousX], APlayerData[playerid][PreviousY], APlayerData[playerid][PreviousZ]);
APlayerData[playerid][PreviousInt] = GetPlayerInterior(playerid);
if(APlayerData[playerid][DJLevel] == 2)
{
format(msg, 128, "{FFD700}O VIP {FFFFFF}%s {FFD700}criou um(a) {FFFFFF}%s{FFD700}.", rNome(playerid), Vehicles[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
SendClientMessageToAll(-1, msg);
}
if(APlayerData[playerid][PlayerLevel] == 1)
{
format(msg, 128, "{FFD700}O VIP {FFFFFF}%s {FFD700}criou um(a) {FFFFFF}%s{FFD700}.", rNome(playerid), Vehicles[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
SendClientMessageToAll(-1, msg);
}
if(APlayerData[playerid][PlayerLevel] >= 2)
{
format(msg, 128, "{32CD32}O Administrador {FFFFFF}%s {32CD32}criou um(a) {FFFFFF}%s{32CD32}.", rNome(playerid), Vehicles[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
SendClientMessageToAll(-1, msg);
}
for(new p = 0; p < MAX_PLAYERS; p++)
{
if(PlayerInfo[p][NoEvento] == 1)
{
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, rot);
vID = Vehicle_Create(ACars[CarIndex][CarModel], x, y, z, rot, random(126), random(126), 600);
// Put the player in the vehicle
PutPlayerInVehicle(playerid, vID, 0);
// Turn on the engine and lights
GetVehicleParamsEx(vID, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vID, 1, 1, alarm, doors, bonnet, boot, objective);
LinkVehicleToInterior(vID, EventInfo[Interior]);
SetVehicleVirtualWorld(vID, EventInfo[VirtualWorld]);
PutPlayerInVehicle(p, vID, 0);
PlayerInfo[p][Carro] = vID;
}
}
APlayerData[playerid][DialogCarFirstCar] = 0;
}
}
return 1;
}
PHP код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
if (AVehicleData[vehicleid][Fuel] > 0)
{
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 1, 1, alarm, doors, bonnet, boot, objective);
}
GetPlayerPos(playerid, APlayerData[playerid][PreviousX], APlayerData[playerid][PreviousY], APlayerData[playerid][PreviousZ]);
APlayerData[playerid][PreviousInt] = GetPlayerInterior(playerid);
return 1;
}