05.01.2017, 22:29
(
Последний раз редактировалось Revelation; 05.01.2017 в 22:38.
Причина: .
)
Hola, uso el sistema de carreras de RyDer y todo normal, pero cuando el server llega a una tal cantidad de usuarios (mбs de 100 usuarios) y ya sea que un usuario crea la carrera o el sistema de carreras crea automбticamente la carrera los comandos para ingresar a la carrera se empiezan a buguear, dice que no hay ninguna carrera disponible para entrar siendo que la carrera se estб iniciando, pones /Join y en el caso de los players les dice eso y aparte los deja congelados y el server responde diciйndole que no existe el comando, incluso los TexdtDraw's que anuncian la carrera se quedan bugueados, porque una vez que empieza la carrera estos se quitan, pero no, se quedan congelados.. Intento terminarlas con /stoprace o /desbugrace y se quedan congeladas las funciones dejando inutilizable el sistema. xd
Pienso que la funciуn ForEach(i, MAX_PLAYERS) es la que buguea todo el sistema... No tengo ningъn define con MAX_PLAYERS
Pienso que la funciуn ForEach(i, MAX_PLAYERS) es la que buguea todo el sistema... No tengo ningъn define con MAX_PLAYERS
PHP код:
CMD:join(playerid, params[])
{
if(RaceStarted == 1)
return SendClientMessage(playerid, Rojo, "<!> La carrera ya empeso! Espera que termine!");
if(RaceBusy == 0x00)
return SendClientMessage(playerid, Rojo, "<!> No hay carreras para competir!");
if(Joined[playerid] == true)
return SendClientMessage(playerid, Rojo, "<!> Has Entrado a la carrera!");
if(IsPlayerInAnyVehicle(playerid))
return SetTimerEx("SetupRaceForPlayer", 2500, 0, "e", playerid), RemovePlayerFromVehicle(playerid), Joined[playerid] = true,SetPlayerVirtualWorld(playerid,5);
SetupRaceForPlayer(playerid);
ResetPlayerWeapons(playerid);
SetPlayerVirtualWorld(playerid,5);
Joined[playerid] = true;
DisableRemoteVehicleCollisions(playerid, 1);
return 1;
}
CMD:stoprace(playerid, params[])
{
if(Informacion[playerid][pVip] >= 3 )
{
new string[128];
GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"* Jugador VIP (ID:%d) %s utilizу el comando /StopRace",playerid,string);
MensajesVip(amarillo,string);
if(RaceBusy == 0x00 || RaceStarted == 0) return SendClientMessage(playerid, Rojo, "* No hay carreras activas!");
StopRace();
}
else return NoEsVIP(playerid);
return 1;
}
CMD:desbugrace(playerid, params[])
{
if(Informacion[playerid][Admin] >= 1 || Informacion[playerid][pVip] >= 3 )
{
new string[128];
GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"* Jugador VIP (ID:%d) %s utilizу el comando /desbugrace",playerid,string);
MensajesVip(amarillo,string);
KillTimer(rCounter);
KillTimer(CountTimer);
RaceStarted = 0;
RaceTick = 0;
JoinCount = 0;
FinishCount = 0;
RaceBusy = 0x00;
ForEach(i, MAX_PLAYERS)
{
GetPlayerVirtualWorld(i);
if(GetPlayerVirtualWorld(i) != 0)
{
if(MiniJuego[i] == MJ_NO && Informacion[i][Jailed] == 0 && UserEnJuego[i] == 0)
{
DisablePlayerRaceCheckpoint(i);
DestroyVehicle(CreatedRaceVeh[i]);
Joined[i] = false;
CPProgess[i] = 0;
KillTimer(InfoTimer[i]);
SetPlayerVirtualWorld(i,0);
DisableRemoteVehicleCollisions(i,0);
}
SendClientMessage(playerid,Rojo,"* Carreras desbugeadas.");
}
}
}
else return NoEsVIP(playerid);
return 1;
}
function LoadRaceNames()
{
new
rNameFile[64],
string[64]
;
format(rNameFile, sizeof(rNameFile), "/rRaceSystem/RaceNames/RaceNames.txt");
TotalRaces = dini_Int(rNameFile, "TotalRaces");
Loop(x, TotalRaces)
{
format(string, sizeof(string), "Race_%d", x), strmid(RaceNames[x], dini_Get(rNameFile, string), 0, 20, sizeof(RaceNames));
/*printf(">> Loaded Races: %s", RaceNames[x]);*/
}
return 1;
}
function LoadAutoRace(rName[])
{
new
rFile[256],
string[256]
;
format(rFile, sizeof(rFile), "/rRaceSystem/%s.RRACE", rName);
if(!dini_Exists(rFile)) return printf("Race \"%s\" doesn't exist!", rName);
strmid(RaceName, rName, 0, strlen(rName), sizeof(RaceName));
RaceVehicle = dini_Int(rFile, "vModel");
RaceType = dini_Int(rFile, "rType");
TotalCP = dini_Int(rFile, "TotalCP");
#if DEBUG_RACE == 1
printf("VehicleModel: %d", RaceVehicle);
printf("RaceType: %d", RaceType);
printf("TotalCheckpoints: %d", TotalCP);
#endif
Loop(x, 2)
{
format(string, sizeof(string), "vPosX_%d", x), RaceVehCoords[x][0] = dini_Float(rFile, string);
format(string, sizeof(string), "vPosY_%d", x), RaceVehCoords[x][1] = dini_Float(rFile, string);
format(string, sizeof(string), "vPosZ_%d", x), RaceVehCoords[x][2] = dini_Float(rFile, string);
format(string, sizeof(string), "vAngle_%d", x), RaceVehCoords[x][3] = dini_Float(rFile, string);
#if DEBUG_RACE == 1
//printf("VehiclePos %d: %f, %f, %f, %f", x, RaceVehCoords[x][0], RaceVehCoords[x][1], RaceVehCoords[x][2], RaceVehCoords[x][3]);
#endif
}
Loop(x, TotalCP)
{
format(string, sizeof(string), "CP_%d_PosX", x), CPCoords[x][0] = dini_Float(rFile, string);
format(string, sizeof(string), "CP_%d_PosY", x), CPCoords[x][1] = dini_Float(rFile, string);
format(string, sizeof(string), "CP_%d_PosZ", x), CPCoords[x][2] = dini_Float(rFile, string);
#if DEBUG_RACE == 1
//printf("RaceCheckPoint %d: %f, %f, %f", x, CPCoords[x][0], CPCoords[x][1], CPCoords[x][2]);
#endif
}
Position = 0;
FinishCount = 0;
JoinCount = 0;
Loop(x, 2) PlayersCount[x] = 0;
CountAmount = COUNT_DOWN_TILL_RACE_START;
RaceTime = MAX_RACE_TIME;
RaceBusy = 0x01;
CountTimer = SetTimer("CountTillRace", 999, 1);
// TimeProgress = 0;
return 1;
}
function LoadRace(playerid, rName[])
{
new
rFile[256],
string[256]
;
format(rFile, sizeof(rFile), "/rRaceSystem/%s.RRACE", rName);
if(!dini_Exists(rFile)) return SendClientMessage(playerid, Rojo, "<!> Race doesn't exist!"), printf("Race \"%s\" doesn't exist!", rName);
strmid(RaceName, rName, 0, strlen(rName), sizeof(RaceName));
RaceVehicle = dini_Int(rFile, "vModel");
RaceType = dini_Int(rFile, "rType");
TotalCP = dini_Int(rFile, "TotalCP");
#if DEBUG_RACE == 1
printf("VehicleModel: %d", RaceVehicle);
printf("RaceType: %d", RaceType);
printf("TotalCheckpoints: %d", TotalCP);
#endif
Loop(x, 2)
{
format(string, sizeof(string), "vPosX_%d", x), RaceVehCoords[x][0] = dini_Float(rFile, string);
format(string, sizeof(string), "vPosY_%d", x), RaceVehCoords[x][1] = dini_Float(rFile, string);
format(string, sizeof(string), "vPosZ_%d", x), RaceVehCoords[x][2] = dini_Float(rFile, string);
format(string, sizeof(string), "vAngle_%d", x), RaceVehCoords[x][3] = dini_Float(rFile, string);
#if DEBUG_RACE == 1
//printf("VehiclePos %d: %f, %f, %f, %f", x, RaceVehCoords[x][0], RaceVehCoords[x][1], RaceVehCoords[x][2], RaceVehCoords[x][3]);
#endif
}
Loop(x, TotalCP)
{
format(string, sizeof(string), "CP_%d_PosX", x), CPCoords[x][0] = dini_Float(rFile, string);
format(string, sizeof(string), "CP_%d_PosY", x), CPCoords[x][1] = dini_Float(rFile, string);
format(string, sizeof(string), "CP_%d_PosZ", x), CPCoords[x][2] = dini_Float(rFile, string);
#if DEBUG_RACE == 1
//printf("RaceCheckPoint %d: %f, %f, %f", x, CPCoords[x][0], CPCoords[x][1], CPCoords[x][2]);
#endif
}
Position = 0;
FinishCount = 0;
JoinCount = 0;
Loop(x, 2) PlayersCount[x] = 0;
Joined[playerid] = true;
//Informacion[playerid][Modo] = 2;
//DisableRemoteVehicleCollisions(playerid, 1);
CountAmount = COUNT_DOWN_TILL_RACE_START;
RaceTime = MAX_RACE_TIME;
RaceBusy = 0x01;
// TimeProgress = 0;
SetupRaceForPlayer(playerid);
CountTimer = SetTimer("CountTillRace", 999, 1);
return 1;
}
function SetupRaceForPlayer(playerid)
{
CPProgess[playerid] = 0;
FreezePlayer( playerid );
CPCoords[playerid][3] = 0;
SetCP(playerid, CPProgess[playerid], CPProgess[playerid]+1, TotalCP, RaceType);
if(IsOdd(playerid)) IndexD = 1;
else IndexD = 0;
switch(IndexD)
{
case 0:
{
if(PlayersCount[0] == 1)
{
RaceVehCoords[0][0] -= (6 * floatsin(-RaceVehCoords[0][3], degrees));
RaceVehCoords[0][1] -= (6 * floatcos(-RaceVehCoords[0][3], degrees));
CreatedRaceVeh[playerid] = CreateVehicle(RaceVehicle, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2]+2, RaceVehCoords[0][3], random(126), random(126), (60 * 60));
SetPlayerPos(playerid, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2]+2);
SetPlayerFacingAngle(playerid, RaceVehCoords[0][3]);
SetPlayerVirtualWorld(playerid,5);
SetVehicleVirtualWorld(CreatedRaceVeh[playerid], 5);
TextDrawHideForPlayer(playerid, AnuncioCarrera);
TextDrawHideForPlayer(playerid, TextoAnuncioCarrera);
Informacion[playerid][SuperVelocidad] = 0;
Informacion[playerid][GodCar] = 1;
DisableRemoteVehicleCollisions(playerid, 1);
ResetPlayerWeapons(playerid);
SetPlayerVirtualWorld(playerid,5);
Joined[playerid] = true;
//DisableRemoteVehicleCollisions(playerid, 1);
PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0);
Camera(playerid, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2], RaceVehCoords[0][3], 20);
}
}
case 1:
{
if(PlayersCount[1] == 1)
{
RaceVehCoords[1][0] -= (6 * floatsin(-RaceVehCoords[1][3], degrees));
RaceVehCoords[1][1] -= (6 * floatcos(-RaceVehCoords[1][3], degrees));
CreatedRaceVeh[playerid] = CreateVehicle(RaceVehicle, RaceVehCoords[1][0], RaceVehCoords[1][1], RaceVehCoords[1][2]+2, RaceVehCoords[1][3], random(126), random(126), (60 * 60));
SetPlayerVirtualWorld(playerid,5);
PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0);
SetPlayerPos(playerid, RaceVehCoords[1][0], RaceVehCoords[1][1], RaceVehCoords[1][2]+2);
SetPlayerFacingAngle(playerid, RaceVehCoords[1][3]);
PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0);
SetVehicleVirtualWorld(CreatedRaceVeh[playerid], 5);
TextDrawHideForPlayer(playerid, AnuncioCarrera);
TextDrawHideForPlayer(playerid, TextoAnuncioCarrera);
Informacion[playerid][SuperVelocidad] = 0;
Informacion[playerid][GodCar] = 1;
ResetPlayerWeapons(playerid);
SetPlayerVirtualWorld(playerid,5);
Joined[playerid] = true;
DisableRemoteVehicleCollisions(playerid, 1);
PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0);
Camera(playerid, RaceVehCoords[1][0], RaceVehCoords[1][1], RaceVehCoords[1][2], RaceVehCoords[1][3], 20);
}
}
}
switch(IndexD)
{
case 0:
{
if(PlayersCount[0] != 1)
{
CreatedRaceVeh[playerid] = CreateVehicle(RaceVehicle, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2]+2, RaceVehCoords[0][3], random(126), random(126), (60 * 60));
PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0);
SetPlayerPos(playerid, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2]+2);
SetPlayerFacingAngle(playerid, RaceVehCoords[0][3]);
SetPlayerVirtualWorld(playerid,5);
PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0);
SetVehicleVirtualWorld(CreatedRaceVeh[playerid], 5);
TextDrawHideForPlayer(playerid, AnuncioCarrera);
TextDrawHideForPlayer(playerid, TextoAnuncioCarrera);
Informacion[playerid][SuperVelocidad] = 0;
Informacion[playerid][GodCar] = 1;
ResetPlayerWeapons(playerid);
SetPlayerVirtualWorld(playerid,5);
Joined[playerid] = true;
DisableRemoteVehicleCollisions(playerid, 1);
PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0);
Camera(playerid, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2], RaceVehCoords[0][3], 20);
PlayersCount[0] = 1;
}
}
case 1:
{
if(PlayersCount[1] != 1)
{
CreatedRaceVeh[playerid] = CreateVehicle(RaceVehicle, RaceVehCoords[1][0], RaceVehCoords[1][1], RaceVehCoords[1][2]+2, RaceVehCoords[1][3], random(126), random(126), (60 * 60));
PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0);
SetPlayerPos(playerid, RaceVehCoords[1][0], RaceVehCoords[1][1], RaceVehCoords[1][2]+2);
SetPlayerFacingAngle(playerid, RaceVehCoords[1][3]);
TextDrawHideForPlayer(playerid, AnuncioCarrera);
TextDrawHideForPlayer(playerid, TextoAnuncioCarrera);
SetPlayerVirtualWorld(playerid,5);
PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0);
SetVehicleVirtualWorld(CreatedRaceVeh[playerid], 5);
Informacion[playerid][SuperVelocidad] = 0;
Informacion[playerid][GodCar] = 1;
ResetPlayerWeapons(playerid);
SetPlayerVirtualWorld(playerid,5);
Joined[playerid] = true;
DisableRemoteVehicleCollisions(playerid, 1);
PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0);
Camera(playerid, RaceVehCoords[1][0], RaceVehCoords[1][1], RaceVehCoords[1][2], RaceVehCoords[1][3], 20);
PlayersCount[1] = 1;
}
}
}
JoinCount++;
return 1;
}
function CountTillRace()
{
switch(CountAmount)
{
case 0:
{
ForEach(i, MAX_PLAYERS)
{
if(Joined[i] == false)
{
TextDrawHideForAll(AnuncioCarrera);
TextDrawHideForAll(TextoAnuncioCarrera);
}
}
StartRace();
}
case 1..5:
{
new string[100];
ForEach(i, MAX_PLAYERS)
{
if(Joined[i] == true)
{
SetCameraBehindPlayer(i);
format(string, sizeof(string), "~G~~h~~h~%d!", CountAmount);
}
if(Joined[i] == true)
{
GameTextForPlayer(i, string, 999, 5);
PlayerPlaySound(i, 1039, 0.0, 0.0, 0.0);
}
}
}
case 6..29:
{
new
string[100]
;
format(string, sizeof(string), "~n~~r~~h~~h~%d!", CountAmount);
ForEach(i, MAX_PLAYERS)
{
if(Joined[i] == true)
{
GameTextForPlayer(i, string, 999, 5);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
}
}
case 30:
{
new string[500];
ForEach(i, MAX_PLAYERS)
{
if(MiniJuego[i] == MJ_NO && Joined[i] == false && Informacion[i][Jailed] == 0)
{
format(string, sizeof(string), "{00FF00}|| Carrera || En %d segundos comienza la carrera {FFFFFF}%s {00FF00}Escribe {FFFFFF}/Join {00FF00}para participar", CountAmount ,RaceName);
SendClientMessage(i,verde, string);
}
}
TextDrawShowForAll(TextoAnuncioCarrera);
TextDrawShowForAll(AnuncioCarrera);
}
}
return CountAmount--;
}
function StartRace()
{
ForEach(i, MAX_PLAYERS)
{
if(Joined[i] == true)
{
PlayerPlaySound(i, 1141, 0.0, 0.0, 0.0);
GameTextForPlayer(i, "~b~~h~~h~ya ya ya!!!!", 2000, 5);
UnfreezePlayer( i );
TextDrawHideForAll(AnuncioCarrera);
TextDrawHideForAll(TextoAnuncioCarrera);
}
}
//rCounter = SetTimer("RaceCounter", 10*60, 1);
rCounter = SetTimer("RaceCounter", 900, 1);
RaceTick = GetTickCount();
RaceStarted = 1;
KillTimer(CountTimer);
return 1;
}
function StopRace()
{
KillTimer(rCounter);
RaceStarted = 0;
RaceTick = 0;
JoinCount = 0;
FinishCount = 0;
RaceBusy = 0x00;
// TimeProgress = 0;
ForEach(i, MAX_PLAYERS)
{
GetPlayerVirtualWorld(i);
if(GetPlayerVirtualWorld(i) != 0)
{
if(Joined[i] == true)
{
DisablePlayerRaceCheckpoint(i);
DestroyVehicle(CreatedRaceVeh[i]);
Joined[i] = false;
CPProgess[i] = 0;
KillTimer(InfoTimer[i]);
SetPlayerVirtualWorld(i,0);
DisableRemoteVehicleCollisions(i,0);
}
}
}
TextDrawHideForAll(AnuncioCarrera);
TextDrawHideForAll(TextoAnuncioCarrera);
if(AutomaticRace == true) LoadRaceNames(), LoadAutoRace(RaceNames[random(TotalRaces)]);
return 1;
}