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

Olб estou com um bug em meu servidor que quando um player cria um carro no /carros demora pra carregar o velocimetro e as vezes nгo carrega e da You Are The Banned.
no server.log aparece [warning] client exceeded 'ackslimit' (14616) Limit: 11000/sec
GM PPC TRUCKING
Reply
#2

Quote:
Originally Posted by murilo789
Посмотреть сообщение
Olб estou com um bug em meu servidor que quando um player cria um carro no /carros demora pra carregar o velocimetro e as vezes nгo carrega e da You Are The Banned.
no server.log aparece [warning] client exceeded 'ackslimit' (14616) Limit: 11000/sec
GM PPC TRUCKING
Poste o comando /Carros.
Reply
#3

COMMAND:carros(playerid, params[])
{

// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player's admin-level is at least 1
if (APlayerData[playerid][PlayerLevel] >= 1)
{
// Make sure the player isn't inside a vehicle
if (GetPlayerVehicleID(playerid) == 0)
CarList_Create(playerid); // Create a list of cars (only the first 10 cars) and show the dialog so the player can choose a car
}
else
return 0;
}
else
return 0;

// Let the server know that this was a valid command
return 1;
}
Reply
#4

Quote:
Originally Posted by murilo789
Посмотреть сообщение
COMMAND:carros(playerid, params[])
{

// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player's admin-level is at least 1
if (APlayerData[playerid][PlayerLevel] >= 1)
{
// Make sure the player isn't inside a vehicle
if (GetPlayerVehicleID(playerid) == 0)
CarList_Create(playerid); // Create a list of cars (only the first 10 cars) and show the dialog so the player can choose a car
}
else
return 0;
}
else
return 0;

// Let the server know that this was a valid command
return 1;
}
Mande o codigo do "CarList_Create"
Reply
#5

Dialog_Car(playerid, response, listitem)
{
// Just close the dialog if the player clicked "Cancel"
if(!response)
{
// Reset the FirstCar (so the list won't start at an unexpected location in the list, but back at the start of the list)
APlayerData[playerid][DialogCarFirstCar] = 0;
return 1; // Exit the function
}

// Process the selected listitem
switch (listitem)
{
case 10: // Player chooses the empty line between the carlist and "Next...", so refresh the current list
{
// Refresh the current list of cars and let the player choose one (show dialog)
CarList_Create(playerid);
// Exit the function
return 1;
}
case 11: // Player chooses "Next..."
{
// Add 10 to the FirstCar, so the list will start further down the array (will show the next 10 cars)
APlayerData[playerid][DialogCarFirstCar] = APlayerData[playerid][DialogCarFirstCar] + 10;
// Create a new list of cars and show the dialog
CarList_Create(playerid);
}
default: // Player chooses a car
{
// Setup local variables
new Float, Float:y, Float:z, Float:rot, CarIndex, msg[128], vID;
new engine,lights,alarm,doors,bonnet,boot,objective;

// FirstCar is the index of the first car in the list, so select the proper index when a car is chosen by the player
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);
// 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);
// Store the player's current location and interior-id, otherwise anti-airbreak hack code could kick you
GetPlayerPos(playerid, APlayerData[playerid][PreviousX], APlayerData[playerid][PreviousY], APlayerData[playerid][PreviousZ]);
APlayerData[playerid][PreviousInt] = GetPlayerInterior(playerid);
// Inform all players about it
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;
}
}
// Also, after spawning a vehicle, reset FirstCar (so next time, the list starts from the start)
APlayerData[playerid][DialogCarFirstCar] = 0;
}
}

return 1;
}
Reply
#6

n mudou nada
Reply
#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
#8

nada resolvido.
Reply
#9

Use crashdetec. Eu acredito que deve ter alguma coisa errada em OnPlayStateChange ou OnVehicleEnter.

@Edit
Mostre o cуdigodo velocнmetro.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)