Dъvida -
Tassi - 13.07.2017
Estou com um problema em minha GM.
Comecei ela esses dias, sу para testes mesmo.
Eu implementei esse comando /AFK + Motivo, ele estб funcionando tudo certinho.
Porйm in-game, se eu digitar o comando, que й /afk [motivo], ao invйs de sair o motivo que o Player digitou, ele sai um "я".
Por exemplo, eu digito /afk Jantar.
Ele printa la na tela:
O Jogador NOME estб Ausente. Motivo: я.
Poderiam me ajudar com isso?
Cуdigo do comando abaixo.
Код:
CMD:afk(playerid, params[])
{
new Motivo[256];
if(sscanf(params, "us[30]", Motivo)) return SendClientMessage (playerid, -1, "| INFO | {FF0000}Use: /AFK Motivo !");
if(strlen(Motivo) > 50 ) return SendClientMessage(playerid, -1, "| INFO | {E04E4E}Motivo muito grande !\n Apenas 50 caracteres ou menos !");
new Nome[MAX_PLAYER_NAME], string[2000];
GetPlayerName(playerid, Nome, MAX_PLAYER_NAME);
if(PlayerAFK[playerid] == false)
{
PlayerAFK[playerid] = true;
TogglePlayerControllable(playerid, 0);
SetPlayerChatBubble(playerid, " Ausente / AFK ", 0xFF0000FF, 100.0, 100000000);
format(string, sizeof(string), "| INFO | O Jogador {1cd600}%s {ffffff}Estб {ff0000}Ausente {ffffff}! Motivo: {FFFFFF}%s", Nome, Motivo);
SendClientMessageToAll(-1, string);
}
return 1;
}
Re: Dъvida -
OtimoJogo - 13.07.2017
Vc so fez o codigo na linha do Sscanf errado procure essa Linha:
PHP код:
if(sscanf(params, "us[30]", Motivo)) return SendClientMessage (playerid, -1, "| INFO | {FF0000}Use: /AFK Motivo !");
E coloque essa no lugar:
PHP код:
if(sscanf(params, "s[256]", Motivo)) return SendClientMessage (playerid, -1, "| INFO | {FF0000}Use: /AFK Motivo !");
Re: Dъvida -
AdrianoStk - 13.07.2017
Assim como o companheiro acima disse, estб correto!
Uma dica a vocк, nгo sei o onde ira hospedar o seu Game Mode, mas procure otimizar ele, exemplo processamento, reserva em memoria etc, alguns host implicam com isso exemplo
new string[2000], quando no maximo ira utilizar 128, mйtodos como este podem otimizar sua GM!
Enfim, tomei liberdade e fiz o comando afk unico, evitando o comando /sairafk, enfim caso queira utilizar estб ai!
PHP код:
CMD:afk(playerid, params[])
{
new Nome[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, Nome, MAX_PLAYER_NAME);
if(PlayerAFK[playerid])
{
PlayerAFK[playerid] = false;
TogglePlayerControllable(playerid, 1);
SetPlayerChatBubble(playerid, " ", 0xFF0000FF, 1.0, 100);
format(string, sizeof(string), "| INFO | O Jogador {1cd600}%s {ffffff}saiu do modo {ff0000}Ausente!", Nome);
}
else
{
new Motivo[64];//Esconomiza espaзo em memoria ram
if(sscanf(params, "us", Motivo)) return SendClientMessage (playerid, -1, "| INFO | {FF0000}Use: /AFK Motivo !");
if(strlen(Motivo) > 50 ) return SendClientMessage(playerid, -1, "| INFO | {E04E4E}Motivo muito grande !\n Apenas 50 caracteres ou menos !");
PlayerAFK[playerid] = true;
TogglePlayerControllable(playerid, 0);
SetPlayerChatBubble(playerid, " Ausente / AFK ", 0xFF0000FF, 100.0, 100000000);
format(string, sizeof(string), "| INFO | O Jogador {1cd600}%s {ffffff}Estб {ff0000}Ausente {ffffff}! Motivo: {FFFFFF}%s", Nome, Motivo);
}
SendClientMessageToAll(-1, string);//Mensagem a todos
return 1;
}
Re: Dъvida -
Tassi - 13.07.2017
Obrigado pelas dicas hahaha, sou "meio" exagerado. Muito obrigado, deu certo!