[AJUDA]Comando nгo seta os cara sу eu -
Nake01 - 29.06.2011
Galera esse comando de setar Admin nгo ta funfando com os cara sу dar pra setar eu mesmo os outros nгo ta setando
PHP код:
if(!strcmp(cmd, "/setadmin", true))
{
new Level;
new Sjim[256];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(!IsPlayerAdmin(playerid) && PlayerInfo[playerid][Admin] < 5)
{
SendClientMessage(playerid, 0xFC4430AA, "¤ Vocк nгo й administrador logado na RCON !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFF6F28AA, "¤ Uso correto: /setaradmin [id] [level]");
return 1;
}
playerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFF6F28AA, "¤ Uso correto: /setaradmin [id] [level]");
return 1;
}
Level = strval(tmp);
if(Level < 0 || Level > 5) return SendClientMessage(playerid, 0xFFFF00AA, "¤ Somente level de administrador entre 1 e 5!");
if(IsPlayerConnected(playerid))
{
if(playerid != INVALID_PLAYER_ID)
{
format(Sjim, sizeof(Sjim), "¤ Vocк deu б %s (ID:%d), level %d de administrador.", name, playerid, Level);
SendClientMessage(playerid, 0x00A400AA, Sjim);
format(Sjim, sizeof(Sjim), "¤ [PROMOVIDO] O Administrador %s lhe deu Level %d de Administrador!", name, Level);
SendClientMessage(playerid, 0x00FF00AA, Sjim);
GameTextForPlayer(playerid, "~p~PROMOVIDO!", 5000, 0);
PlayerInfo[playerid][Admin] = Level;
format(file, sizeof(file), "Contas/%s.ini", name);
if(!dini_Exists(file))
{
dini_Create(file);
dini_IntSet(file, "Level", Level);
}
else
{
dini_IntSet(file, "Level", Level);
PlayerInfo[playerid][Admin] = Level;
}
return 1;
}
return 1;
}
else
{
SendClientMessage(playerid, 0xFC4430AA, "¤ (ERRO) Jogador nгo conectado!");
return 1;
}
}
Re: [AJUDA]Comando nгo seta os cara sу eu -
Macintosh - 29.06.2011
pawn Код:
if(!strcmp(cmd, "/setadmin", true))
{
new Level;
new Sjim[256];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(!IsPlayerAdmin(playerid) && PlayerInfo[playerid][Admin] < 5) return SendClientMessage(playerid, 0xFC4430AA, "¤ Vocк nгo й administrador logado na RCON !");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, 0xFF6F28AA, "¤ Uso correto: /setaradmin [id] [level]");
playerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, 0xFF6F28AA, "¤ Uso correto: /setaradmin [id] [level]");
Level = strval(tmp);
if(Level < 1 || Level > 5) return SendClientMessage(playerid, 0xFFFF00AA, "¤ Somente level de administrador entre 1 e 5!");
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, 0xFC4430AA, "¤ (ERRO) Jogador nгo conectado!");
if(playerid != INVALID_PLAYER_ID)
{
format(Sjim, sizeof(Sjim), "¤ Vocк deu б %s (ID:%d), level %d de administrador.", name, playerid, Level);
SendClientMessage(playerid, 0x00A400AA, Sjim);
format(Sjim, sizeof(Sjim), "¤ [PROMOVIDO] O Administrador %s lhe deu Level %d de Administrador!", name, Level);
SendClientMessage(playerid, 0x00FF00AA, Sjim);
GameTextForPlayer(playerid, "~p~PROMOVIDO!", 5000, 0);
PlayerInfo[giveplayerid][Admin] = Level;
format(file, sizeof(file), "Contas/%s.ini", name);
if(!dini_Exists(file))
{
dini_Create(file);
dini_IntSet(file, "Level", Level);
}
else
{
dini_IntSet(file, "Level", Level);
PlayerInfo[giveplayerid][Admin] = Level;
}
return 1;
}
return 1;
}
}
Re: [AJUDA]Comando nгo seta os cara sу eu -
Nake01 - 29.06.2011
Shickcard ta dando agr o seguinte erro a menssagem apareзe pro ъsuario,sendo que eu que ganho o nнvel envez dele '-'
Re: [AJUDA]Comando nгo seta os cara sу eu -
RockFire - 29.06.2011
PHP код:
if(!strcmp(cmd, "/setadmin", true))
{
new Sjim[128],name[24],val[2],_tmp[2][128];
if(!IsPlayerAdmin(playerid) && PlayerInfo[playerid][Admin] < 5) return SendClientMessage(playerid, 0xFC4430AA, "¤ Vocк nгo й administrador logado na RCON !");
_tmp[0] = strtok(cmdtext, idx), val[0] = strval(_tmp[0]);
_tmp[1] = strtok(cmdtext, idx), val[1] = strval(_tmp[1]);
if(!strlen(_tmp[0]) || !strlen(_tmp[1])) return SendClientMessage(playerid, 0xFF6F28AA, "¤ Uso correto: /setaradmin [id] [level]");
if(val[1] < 0 || val[1] > 5) return SendClientMessage(playerid, 0xFFFF00AA, "¤ Somente level de administrador entre 1 e 5!");
GetPlayerName(val[0],name,sizeof(name));
if(val[0] == 0xFFFF) return SendClientMessage(playerid, 0xFC4430AA, "¤ (ERRO) Jogador nгo conectado!");
format(Sjim, sizeof(Sjim), "¤ Vocк deu б %s (ID:%d), level %d de administrador.", name, val[0], val[1]);
GetPlayerName(playerid,name,sizeof(name));
SendClientMessage(playerid, 0x00A400AA, Sjim);
format(Sjim, sizeof(Sjim), "¤ [PROMOVIDO] O Administrador %s lhe deu Level %d de Administrador!", name, Level);
SendClientMessage(val[0], 0x00FF00AA, Sjim);
GameTextForPlayer(val[0], "~p~PROMOVIDO!", 5000, 0);
PlayerInfo[playerid][Admin] = val[1];
format(file, sizeof(file), "Contas/%s.ini", name);
if(!dini_Exists(file))
{
dini_Create(file);
dini_IntSet(file, "Level",val[1]);
}
else
{
dini_IntSet(file, "Level", val[1]);
PlayerInfo[playerid][Admin] = val[1];
}
return true;
}
Re: [AJUDA]Comando nгo seta os cara sу eu -
Nake01 - 29.06.2011
@Felipe deu esses erros
PHP код:
C:\Documents and Settings\Weeeeen_@\Meus documentos\Servidor GTE\filterscripts\FS.pwn(310) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Weeeeen_@\Meus documentos\Servidor GTE\filterscripts\FS.pwn(311) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Weeeeen_@\Meus documentos\Servidor GTE\filterscripts\FS.pwn(319) : error 017: undefined symbol "Level"
C:\Documents and Settings\Weeeeen_@\Meus documentos\Servidor GTE\filterscripts\FS.pwn(339) : error 021: symbol already defined: "Sjim"
C:\Documents and Settings\Weeeeen_@\Meus documentos\Servidor GTE\filterscripts\FS.pwn(340) : error 021: symbol already defined: "name"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
5 Errors.
Re: [AJUDA]Comando nгo seta os cara sу eu -
lucas_mdr1235 - 29.06.2011
Tenta \/
pawn Код:
if(!strcmp(cmd, "/setadmin", true))
{
new Level;
new Sjim[256];
new name[MAX_PLAYER_NAME];
new names[MAX_PLAYER_NAME];
if(!IsPlayerAdmin(playerid) && PlayerInfo[playerid][Admin] < 5)
{
SendClientMessage(playerid, 0xFC4430AA, "¤ Vocк nгo й administrador logado na RCON !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFF6F28AA, "¤ Uso correto: /setaradmin [id] [level]");
return 1;
}
new para1;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFF6F28AA, "¤ Uso correto: /setaradmin [id] [level]");
return 1;
}
Level = strval(tmp);
if(Level < 0 || Level > 5) return SendClientMessage(playerid, 0xFFFF00AA, "¤ Somente level de administrador entre 1 e 5!");
GetPlayerName(para1, name, sizeof(name));
GetPlayerName(playerid, names, sizeof(names));
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
format(Sjim, sizeof(Sjim), "¤ Vocк deu б %s (ID:%d), level %d de administrador.", name, para1, Level);
SendClientMessage(playerid, 0x00A400AA, Sjim);
format(Sjim, sizeof(Sjim), "¤ [PROMOVIDO] O Administrador %s lhe deu Level %d de Administrador!", names, Level);
SendClientMessage(para1, 0x00FF00AA, Sjim);
GameTextForPlayer(para1, "~p~PROMOVIDO!", 5000, 0);
PlayerInfo[para1][Admin] = Level;
format(file, sizeof(file), "Contas/%s.ini", name);
if(!dini_Exists(file))
{
dini_Create(file);
dini_IntSet(file, "Level", Level);
}
else
{
dini_IntSet(file, "Level", Level);
PlayerInfo[para1][Admin] = Level;
}
return 1;
}
return 1;
}
else
{
SendClientMessage(playerid, 0xFC4430AA, "¤ (ERRO) Jogador nгo conectado!");
return 1;
}
}
@ EDIT
Ai editei se tiver tentado tenta de novo
Re: [AJUDA]Comando nгo seta os cara sу eu -
Nake01 - 30.06.2011
PHP код:
C:\Documents and Settings\Weeeeen_@\Meus documentos\Servidor GTE\filterscripts\FS.pwn(305) : error 017: undefined symbol "ReturnUser"
Re: [AJUDA]Comando nгo seta os cara sу eu -
lucas_mdr1235 - 30.06.2011
add no final do seu gm \/
pawn Код:
ReturnUser(text[], playerid = INVALID_PLAYER_ID)
{
new pos = 0;
while (text[pos] < 0x21)
{
if (text[pos] == 0) return INVALID_PLAYER_ID;
pos++;
}
new userid = INVALID_PLAYER_ID;
if (IsNumeric(text[pos]))
{
userid = strval(text[pos]);
if (userid >=0 && userid < MAX_PLAYERS)
{
if(!IsPlayerConnected(userid))
{
userid = INVALID_PLAYER_ID;
}
else
{
return userid;
}
}
}
new len = strlen(text[pos]);
new count = 0;
new name[MAX_PLAYER_NAME];
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
GetPlayerName(i, name, sizeof (name));
if (strcmp(name, text[pos], true, len) == 0)
{
if (len == strlen(name))
{
return i;
}
else
{
count++;
userid = i;
}
}
}
}
if (count != 1)
{
if (playerid != INVALID_PLAYER_ID)
{
if (count)
{
SendClientMessage(playerid, 0xFF0000AA, "Multiple users found, please narrow earch");
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "No matching user found");
}
}
userid = INVALID_PLAYER_ID;
}
return userid;
}
@EDIT
fora de public
Re: [AJUDA]Comando nгo seta os cara sу eu -
Nake01 - 30.06.2011
Agora deu esse
PHP код:
C:\Documents and Settings\Weeeeen_@\Meus documentos\Servidor GTE\filterscripts\FS.pwn(2563) : error 017: undefined symbol "IsNumeric"
Re: [AJUDA]Comando nгo seta os cara sу eu -
lucas_mdr1235 - 30.06.2011
em cima do anterior q eu te passei
pawn Код:
IsNumeric(const string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}