[Ajuda] Servidor cai quando entra em um carro criado
#7

PlayerCommands
PHP код:
COMMAND:carros(playeridparams[])
{
  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;

DefCars
PHP код:
CarList_Create(playerid)
{
    new 
CounterCarList[500], DialogTitle[128];
    
    for (new 
APlayerData[playerid][DialogCarFirstCar]; sizeof(ACars); i++)
    {
        
        
Counter++;
        if (
Counter <= 10)
        {
            
            if (
strlen(CarList) == 0
                
format(CarList500"%s"ACars[i][CarName]); 
            else
                
format(CarList500"%s%s%s"CarList"\n"ACars[i][CarName]); 
        }
        else 
        {
            
            
format(CarList500"%s%s%s"CarList"\n \n"TXT_DialogEntryNext);
            
            break;
        }
    }
    
    
format(DialogTitle128TXT_DialogCarTitle, (APlayerData[playerid][DialogCarFirstCar] / 10) + 1);
    
ShowPlayerDialog(playeridDialogCarDIALOG_STYLE_LISTDialogTitleCarListTXT_DialogButtonSpawnTXT_DialogButtonCancel);
    return 
1;

Dialogs
PHP код:
Dialog_Car(playeridresponselistitem)
{
    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:xFloat:yFloat:zFloat:rotCarIndexmsg[128], vID;
            new 
engine,lights,alarm,doors,bonnet,boot,objective;
            
            
CarIndex APlayerData[playerid][DialogCarFirstCar] + listitem;
            
GetPlayerPos(playeridxyz);
            
GetPlayerFacingAngle(playeridrot);
            
vID Vehicle_Create(ACars[CarIndex][CarModel], xyzrotrandom(126), random(126), 600);
            
            
PutPlayerInVehicle(playeridvID0);
            
            
GetVehicleParamsEx(vIDenginelightsalarmdoorsbonnetbootobjective);
            
SetVehicleParamsEx(vID11alarmdoorsbonnetbootobjective);
            
            
GetPlayerPos(playeridAPlayerData[playerid][PreviousX], APlayerData[playerid][PreviousY], APlayerData[playerid][PreviousZ]);
            
APlayerData[playerid][PreviousInt] = GetPlayerInterior(playerid);
        
            if(
APlayerData[playerid][DJLevel] == 2)
            {
                
format(msg128"{FFD700}O VIP {FFFFFF}%s {FFD700}criou um(a) {FFFFFF}%s{FFD700}."rNome(playerid), Vehicles[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
                
SendClientMessageToAll(-1msg);
            }
            if(
APlayerData[playerid][PlayerLevel] == 1)
            {
                
format(msg128"{FFD700}O VIP {FFFFFF}%s {FFD700}criou um(a) {FFFFFF}%s{FFD700}."rNome(playerid), Vehicles[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
                
SendClientMessageToAll(-1msg);
            }
            if(
APlayerData[playerid][PlayerLevel] >= 2)
            {
                
format(msg128"{32CD32}O Administrador {FFFFFF}%s {32CD32}criou um(a) {FFFFFF}%s{32CD32}."rNome(playerid), Vehicles[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
                
SendClientMessageToAll(-1msg);
            }
            for(new 
0MAX_PLAYERSp++)
            {
                if(
PlayerInfo[p][NoEvento] == 1)
                {
                    
GetPlayerPos(playeridxyz);
                    
GetPlayerFacingAngle(playeridrot);
                    
vID Vehicle_Create(ACars[CarIndex][CarModel], xyzrotrandom(126), random(126), 600);
                    
// Put the player in the vehicle
                    
PutPlayerInVehicle(playeridvID0);
                    
// Turn on the engine and lights
                    
GetVehicleParamsEx(vIDenginelightsalarmdoorsbonnetbootobjective);
                    
SetVehicleParamsEx(vID11alarmdoorsbonnetbootobjective);
                    
LinkVehicleToInterior(vIDEventInfo[Interior]);
                    
SetVehicleVirtualWorld(vIDEventInfo[VirtualWorld]);
                    
PutPlayerInVehicle(pvID0);
                    
PlayerInfo[p][Carro] = vID;
                }
            }
            
            
APlayerData[playerid][DialogCarFirstCar] = 0;
        }
    }
    return 
1;

GameMode
PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    new 
enginelightsalarmdoorsbonnetbootobjective;
    if (
AVehicleData[vehicleid][Fuel] > 0)
    {
        
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
        
SetVehicleParamsEx(vehicleid11alarmdoorsbonnetbootobjective);
    }
    
GetPlayerPos(playeridAPlayerData[playerid][PreviousX], APlayerData[playerid][PreviousY], APlayerData[playerid][PreviousZ]);
    
APlayerData[playerid][PreviousInt] = GetPlayerInterior(playerid);
    return 
1;

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)