04.12.2013, 01:25
Mi servidor se congela al llegar a 35 usuarios especificamente y tengo un vps con 2 gb de ram que tiene 2 servs con mas de 200 usuarios cada uno sin NADA de lag es el GM pero no se que pasa uso base ZC
//timers del servidor
timer Anticheat[1000]()
{
foreach(Player, i)
{
if(IsPlayerConnected(i)){
new Float:health, Float:armor;
GetPlayerHealth(i, health);
if(health > Info[i][pHealth]){
SetPlayerHealth(i, Info[i][pHealth]);
}
GetPlayerArmour(i, armor);
if(armor > ScriptArmor[i]){
GiveArmorToPlayer(i, ScriptArmor[i]);
}
}
}
return 1;
}
timer severTimers[1000]()
{
AddsOn();
if(iAdverTimer >= 1)
--iAdverTimer;
foreach(Player, i)
{
SyncPlayerTime(i);
if(IsPlayerConnected(i) && gPlayerLogged{i} == 1)
{
if(Tied[i] > 0) TogglePlayerControllable(i, 0);
if(GetPVarInt(i, "EMSAttempt") == -1) ApplyAnimation(i, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0, 1);
if(CellTime[i] > 0)
{
if (CellTime[i] == cchargetime)
{
CellTime[i] = 1;
if(Mobile[Mobile[i]] == i)
{
CallCost[i] = CallCost[i]+callcost;
}
}
CellTime[i]++;
if (Mobile[Mobile[i]] == INVALID_PLAYER_ID && CellTime[i] == 5)
{
if(IsPlayerConnected(Mobile[i]))
{
new called[MAX_PLAYER_NAME], string[96];
GetPlayerName(Mobile[i], called, sizeof(called));
format(string, sizeof(string), "* El telйfono de %s esta sonando", called);
ProxDetector(30.0, Mobile[i], string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
}
if(CellTime[i] == 0 && CallCost[i] > 0)
{
new string[24];
format(string, sizeof(string), "~w~Costo de llamada~n~~r~%d",CallCost[i]);
GivePlayerCash(i, -CallCost[i]);
GameTextForPlayer(i, string, 5000, 1);
CallCost[i] = 0;
}
for(new h = 0; h < sizeof(Points); h++)
{
if(IsPlayerInRangeOfPoint(i, 2.0, Points[h][Pointx], Points[h][Pointy], Points[h][Pointz])){
if(Points[h][Type] == 3 && Info[i][pPot] < 3){
GameTextForPlayer(i, "~w~Usa /comprarhierba para comprar algo de ~n~~r~hierba", 5000, 5);
}
else if(Points[h][Type] == 1 && GetPVarInt(i, "Packages") == 0){
GameTextForPlayer(i, "~w~Usa /materiales para comprar ~n~~r~paquetes de materiales.", 5000, 5);
}
else if(Points[h][Type] == 4){
GameTextForPlayer(i, "~w~Usa /comprarcrack para comprar ~n~algo de ~r~crack", 5000, 5);
}
else if(Points[h][Type] == 5){
GameTextForPlayer(i, "~w~Usa /paquete para comprar un ~n~~r~paquete de droga", 5000, 5);
}
}
}
if(TransportDriver[i] < 999)
{
if(GetPlayerVehicleID(i) != GetPlayerVehicleID(TransportDriver[i]) || !TransportDuty[TransportDriver[i]])
{
if(IsPlayerConnected(TransportDriver[i]))
{
new string[24];
TransportMoney[TransportDriver[i]] += TransportCost[i];
TransportTime[TransportDriver[i]] = 0;
TransportCost[TransportDriver[i]] = 0;
format(string, sizeof(string), "~w~Pasajero se fue~n~~g~ganaste %d",TransportCost[i]);
GameTextForPlayer(TransportDriver[i], string, 5000, 1);
TransportDriver[i] = 999;
}
}
else if(TransportTime[i] >= 16)
{
TransportTime[i] = 1;
GivePlayerCash(i, -TransportValue[TransportDriver[i]]);
if(TransportDriver[i] < 999)
{
if(IsPlayerConnected(TransportDriver[i]))
{
TransportCost[i] += TransportValue[TransportDriver[i]];
TransportCost[TransportDriver[i]] = TransportCost[i];
}
}
}
TransportTime[i] += 1;
new string[24];
format(string, sizeof(string), "~r~%d ~w~: ~g~%d",TransportTime[i],TransportCost[i]);
GameTextForPlayer(i, string, 15000, 6);
GameTextForPlayer(TransportDriver[i], string, 15000, 6);
if(TransportCost[i] > GetPlayerCash(i))
{
RemovePlayerFromVehicle(i);
new Float:slx, Float:sly, Float:slz;
GetPlayerPos(i, slx, sly, slz);
SetPlayerPos(i, slx, sly, slz + 2);
GameTextForPlayer(i, "~r~No tienes mбs dinero para pagar el taxi!", 4000, 4);
}
}
timer severTimers2[1000](){
foreach(Player, i){
if(IsPlayerConnected(i) && gPlayerLogged{i} == 1){
if(Info[i][pTimePayDay] >= 0)
{
new string[128];
Info[i][pTimePayDay]++;
if(Info[i][pTimePayDay] >= 3600){
new tmpintrate, interest, paytotal;
tmpintrate = 1;
interest = (Info[i][pAccount]/1000)*(tmpintrate);
paytotal = Info[i][pPayCheck]-TaxValue;
if(Info[i][pVIP] == 0 && interest > 50000) interest = 50000;
else if(Info[i][pVIP] == 1 && interest > 100000) interest = 100000;
else if(Info[i][pVIP] == 2 && interest > 150000) interest = 150000;
else if(Info[i][pVIP] == 3 && interest > 200000) interest = 200000;
else if(Info[i][pVIP] >= 4 && interest > 250000) interest = 250000;
Info[i][pAccount] += interest;
if(Info[i][p_Pr_Time] == 10){
SendClientMessageEx(i, COLOR_WHITE, " Ya puedes volver hacer viajes de camionero.");
Info[i][p_Pr_Time] = 0;
}
if(Info[i][pRenting] != INVALID_HOUSE_ID){
if(HouseInfo[Info[i][pRenting]][hRentFee] > Info[i][pAccount]){
Info[i][pRenting] = INVALID_HOUSE_ID;
SendClientMessageEx(i, COLOR_WHITE, "Fuiste desalojado de la casa que rentabas.");
}
else{
HouseInfo[Info[i][pRenting]][hSafeMoney] += HouseInfo[Info[i][pRenting]][hRentFee];
Info[i][pAccount] -= HouseInfo[Info[i][pRenting]][hRentFee];
}
}
Info[i][pRob] = 0;
if(Info[i][pVIP] >= 4) Info[i][pVTokens]+= 2;
if(Info[i][pDobleExp] == 0){Info[i][pExp] += 1;}
else{
Info[i][pExp] += 2;
Info[i][pDobleExp]--;
format(string, sizeof(string), "* Ganaste 2 puntos de respeto por tener horas de doble experiencia, te quedan %d horas mбs.", Info[i][pDobleExp]);
SendClientMessageEx(i, COLOR_YELLOW, string);
}
SendClientMessageEx(i, COLOR_WHITE, "* ESTADO DE CUENTA DEL BANCO DE SAN ANDREAS * ");
format(string, sizeof(string), " Pago: $%d | Impuestos : -$%d", Info[i][pPayCheck], TaxValue);
SendClientMessageEx(i, COLOR_GRAD2, string);
format(string, sizeof(string), " Interйs ganado: 0.%d por ciento", interest);
SendClientMessageEx(i, COLOR_GRAD2, string);
Info[i][pAccount] += paytotal;
format(string, sizeof(string), " Total: $%d | N. Balance : %d$", paytotal, Info[i][pAccount]);
SendClientMessageEx(i, COLOR_GRAD2, string);
SendClientMessageEx(i, COLOR_WHITE, "-------------------------------------------------");
//GivePlayerCash(i, paytotal);
Info[i][pPayCheck] = 0;
Info[i][pTimePayDay] = 0;
Info[i][pConnectTime] += 1;
RewardPlayer(i);
OnPlayerSavedStats(i);
GameTextForPlayer(i, "~y~Pay~n~~w~Check", 5000, 1);
if(Info[i][pConnectTime] == 2){
Info[i][pWRestricted] = 0;
SendClientMessageEx(i, COLOR_GRAD2, "Nota: Cumpliste las 2 horas de juego, la restricciуn de armas fue eliminada");
}
if(Info[i][pAdiccion] > 0) Info[i][pAdiccion] -= 2;
if(Info[i][pWRestricted] > 0){
Info[i][pWRestricted]--;
if(Info[i][pWRestricted] == 1) SendClientMessageEx(i, COLOR_LIGHTRED, "Tus armas ya no estбn restringidas!");
}
}
}
if(GetPlayerPing(i) > MAX_PING){
new string[128];
format(string, sizeof(string), "{0D56E7}[STAFF] >> {FFFFFF} %s ha sido kikeado por tener %d de ping (maximo: 1500).", GetPlayerNameEx(i), GetPlayerPing(i) );
ABroadCast(COLOR_GENERAL, string, 2);
SendClientMessageEx(i, COLOR_GENERAL, "SERVER: {FFFFFF}Has sido expulsado del servidor, tu ping superу el mбximo.");
Kick(i);
}