SA-MP Forums Archive
[Ajuda] strings - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] strings (/showthread.php?tid=598939)



strings - Lucas_HenryK - 18.01.2016

PHP код:
enum ServerInfo {
    
Ping,
    
Fps,
    
Float:Packetloss,
    
    
SV_NAME[50] = "asdsadsad",
    
GM_NAME[25] = "asdsadsad",
    
GM_MAPN[15] = "asdsadasd",
    
GM_SITE[20] = "asdsadasd",
    
GM_LANG[15] = "asdsadasd"
}
new 
sData[ServerInfo]; 
Error: error 008: must be a constant expression; assumed zero

em todas linhas abaixo de Float:Packetloss,


Re: strings - Cidiei - 18.01.2016

Boa tarde, tente da seguinte forma:

pawn Код:
enum ServerInfo {
    Ping,
    Fps,
    Float:Packetloss,
     
    SV_NAME = "asdsadsad",
    GM_NAME = "asdsadsad",
    GM_MAPN = "asdsadasd",
    GM_SITE = "asdsadasd",
    GM_LANG = "asdsadasd"
}
new sData[ServerInfo];
Caso nгo funcione comente abaixo, ficamos no aguardo.

Att.


Re: strings - Coringa_Vilao - 18.01.2016

ou teste:
PHP код:
enum ServerInfo 
    
Ping
    
Fps
    
Float:Packetloss
     
    
SV_NAME[50] = "asdsadsad"
    
GM_NAME[25] = "asdsadsad"
    
GM_MAPN[15] = "asdsadasd"
    
GM_SITE[20] = "asdsadasd"
    
GM_LANG[15] = "asdsadasd" 
}; 
new 
sData[ServerInfo]; 
ou de uma lida: https://sampforum.blast.hk/showthread.php?tid=235924


Re: strings - [BOPE]Seu._.Madruga - 18.01.2016

Me surpreendo quando pessoas velhas tropeзam em coisas bбsicas !
Antes de ensinar tenha certeza de que jб aprendeu.
PHP код:
enum ServerInfo {
    
Ping,
    
Fps,
    
Float:Packetloss,
    
SV_NAME[50],
    
GM_NAME[25],
    
GM_MAPN[15],
    
GM_SITE[20],
    
GM_LANG[15]
};
new 
sData[ServerInfo];
public 
OnGameModeInit()
{
    
format(sData[SV_NAME], 50"Brasil Leonardo Bradoks");
    
format(sData[GM_NAME], 25"BLB");
    
format(sData[GM_MAPN], 15"Los Santos");
    
format(sData[GM_SITE], 20"www.******.com.br");
    
format(sData[GM_LANG], 15"PT-BR");
    return 
1;




Re: strings - Lucas_HenryK - 19.01.2016

Nгo se pode usar array em enumeradores, vou fazer com const.


Re: strings - willttoonn - 19.01.2016

Tente:
pawn Код:
//No topo do GM
#define SERVER_NAME "NOME DO SV"
#define SERVER_URL "SITE DO SV"
#define SERVER_MAP "San Andreas"
#define SERVER_REVISION ("NOME DO GM OU VERSAO")
#define SERVER_LANGUAGE "PT-BR"


//No OnGameModeInit
new rcon[128];
format(rcon, sizeof(rcon), "hostname %s", SERVER_NAME);
SendRconCommand(rcon);
format(rcon, sizeof(rcon), "weburl %s", SERVER_URL);
SendRconCommand(rcon);
format(rcon, sizeof(rcon), "map %s", SERVER_MAP);
SendRconCommand(rcon);
format(rcon, sizeof(rcon), "language %s", SERVER_LANGUAGE);
SendRconCommand(rcon);
SetGameModeText(SERVER_REVISION);