[Ajuda] unfreeze -
noobre - 05.09.2011
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.
Re: [Ajuda] unfreeze -
Bruno Pereira - 05.09.2011
PHP код:
CMD:unfreeze(playerid, params[])
{
if(PlayerInfo[playerid][Adminlevel] > 1)
{
new id;
if(sscanf(params, "u", id))
{
new string[64];
format(string, sizeof(string), "O Administrador %s descongelou-te", pNome(playerid));
SendClientMessage(id, 0x0259EAAA, string);
format(string, sizeof(string), "Descongelaste o jogador %s", pNome(id));
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");
}
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(playerid, nome, sizeof(nome));
return nome;
}
Re: [Ajuda] unfreeze -
Hardware - 05.09.2011
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;
}
Re: [Ajuda] unfreeze -
RebeloX - 05.09.2011
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;
}