[Ajuda] unfreeze
#1

pawn Код:
CMD:unfreeze(playerid, params[])
{
    if(PlayerInfo[playerid][Adminlevel] > 1)
    {
        new id;
        if(sscanf(params, "u", id))
        {
             new string[64];
             new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
             GetPlayerName(playerid, name, sizeof(name));
             GetPlayerName(id, PlayerName, sizeof(PlayerName));
             format(string, sizeof(string), "O Administrador %s descongelou-te", name);
             SendClientMessage(id, 0x0259EAAA, string);
             format(string, sizeof(string), "Descongelaste o jogador %s", PlayerName);
             SendClientMessage(playerid, 0x0259EAAA, string);
             TogglePlayerControllable(id, 1);
             return 1;
        }
        else return SendClientMessage(playerid, 0x0259EAAA, "Comando: /freeze [playerID]");
    }
    else return SendClientMessage(playerid, 0x0259EAAA, "Nao йs Administrador");
}
Bem, este comando estб esquisito, pois eu executo o comando e apenas aparece-me:
IN GAME:

O Administrador %s descongelou-te
Descongelaste o jogador %s

Nao aparece a mensagem para introduzir qual o ID que desejo.
Reply
#2

PHP код:
CMD:unfreeze(playeridparams[])
{
    if(
PlayerInfo[playerid][Adminlevel] > 1)
    {
        new 
id;
        if(
sscanf(params"u"id))
        {
             new 
string[64];
             
format(stringsizeof(string), "O Administrador %s descongelou-te"pNome(playerid));
             
SendClientMessage(id0x0259EAAAstring);
             
format(stringsizeof(string), "Descongelaste o jogador %s"pNome(id));
             
SendClientMessage(playerid0x0259EAAAstring);
             
TogglePlayerControllable(id1);
             return 
1;
        }
        else return 
SendClientMessage(playerid0x0259EAAA"Comando: /freeze [playerID]");
    }
    else return 
SendClientMessage(playerid0x0259EAAA"Nao йs Administrador");

E coloque isso no final do GM:
PHP код:
stock pNome(playerid)
{
//Essa funзгo irб returnar o nome do jogador, sendo assim nгo precisa toda vez usar new nome[MAX_PLAYER_NAME]; GetPlayerName e bla bla bla.
    
new nome[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnomesizeof(nome));
    return 
nome;

Reply
#3

Tente dessa forma.

pawn Код:
CMD:unfreeze(playerid, params[])
{
    if(!PlayerInfo[playerid][Adminlevel] > 1) return SendClientMessage(playerid, 0x0259EAAA, "Nao йs Administrador");
    {
        new id;
        if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0x0259EAAA, "Comando: /freeze [playerID]");
        {
             new string[64];
             new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
             GetPlayerName(playerid, name, sizeof(name));
             GetPlayerName(id, PlayerName, sizeof(PlayerName));
             format(string, sizeof(string), "O Administrador %s descongelou-te", name);
             SendClientMessage(id, 0x0259EAAA, string);
             format(string, sizeof(string), "Descongelaste o jogador %s", PlayerName);
             SendClientMessage(playerid, 0x0259EAAA, string);
             TogglePlayerControllable(id, 1);
             return 1;
        }
    }
    return true;
}
Reply
#4

Sei que jб responderam, mas sу te vou amostrar um truque de optimizaзгo.

pawn Код:
CMD:unfreeze(playerid, params[])
{
    new string[64];
    new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];    
    new id;
    if(PlayerInfo[playerid][Adminlevel] > 1) return SendClientMessage(playerid, 0x0259EAAA, "Nao йs Administrador");
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0x0259EAAA, "Comando: /freeze [playerID]");
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerName(id, PlayerName, sizeof(PlayerName));
    format(string, sizeof(string), "O Administrador %s descongelou-te", name);
    SendClientMessage(id, 0x0259EAAA, string);
    format(string, sizeof(string), "Descongelaste o jogador %s", PlayerName);
    SendClientMessage(playerid, 0x0259EAAA, string);
    TogglePlayerControllable(id, 1);
    return true;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)