23.01.2013, 09:57
Esse code que fiz causa lag e quando digito o cmd ele derruba o servidor!!!!
Code \/
Code \/
pawn Код:
#define MENUSALVO "Truck/Menu/%s.ini"
#define MAX_MENU 50
new MenuServer;
public OnGameModeInit()
{
MenuServer = 0;
for(new x=0; x< MAX_PLAYERS; x++)
{
for(new i=0; i< MAX_MENU; i++)
{
format(Donarquivo, sizeof(Donarquivo), MENUSALVO, MenuServer);
if(DOF2_FileExists(Donarquivo))
MenuServer++;
SetPlayerMapIcon(x, 15, DOF2_GetFloat(Donarquivo, "X"),DOF2_GetFloat(Donarquivo, "Y"),DOF2_GetFloat(Donarquivo, "Z"),52,0);
CreatePickup(162, 1, DOF2_GetFloat(Donarquivo, "X"),DOF2_GetFloat(Donarquivo, "Y"),DOF2_GetFloat(Donarquivo, "Z"));
}
}
return 1;
}
command(criarmenu, playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 1)return SendClientMessage(playerid, -1,"[ERRO] Vocк nгo e admin!");
if(MenuServer == MAX_MENU)return SendClientMessage(playerid, -1,"[ERRO] Limite de menu atingido!");
GetPlayerName(playerid, DName, sizeof(DName));
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
MenuServer++;
format(Donarquivo, sizeof(Donarquivo), MENUSALVO, MenuServer);
if(!DOF2_FileExists(Donarquivo))DOF2_CreateFile(Donarquivo);
DOF2_SetFloat(Donarquivo, "X", Pos[0]);
DOF2_SetFloat(Donarquivo, "Y", Pos[1]);
DOF2_SetFloat(Donarquivo, "Z", Pos[2]);
DOF2_SaveFile();
DOF2_Exit();
SetPlayerMapIcon(playerid, 15, Pos[0], Pos[1], Pos[2],52,0);
CreatePickup(162, 1, Pos[0], Pos[1], Pos[2]);
format(Don,sizeof(Don),"[Aviso] %s criou mais um ponto de menu[Pontos de menu: %d]", DName, MenuServer);
SendClientMessageToAll(CorClasses[PlayerInfo[playerid][pClass]], Don);
return true;
}