SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 22/11/2019, 01:45 PM   #1
Huemerson
Little Clucker
 
Huemerson's Avatar
 
Join Date: Apr 2018
Location: Brasil - Minas Gerais
Posts: 25
Reputation: 1
Default 9/5000 Help with (CMD)

Can someone help me, what is wrong with the Script below, when Level ADM (1342) works correctly, but when Level ADM (1340) is not working ...

I am grateful if you can help me:

Quote:
CMD:criaradmin(playerid, params[])
{
if (gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COR_GREY, "Você não está logado!");
return 1;
}
if (PlayerInfo[playerid][pAdmin] < 1339)
{
SendClientMessage(playerid, COR_GRAD1, "Você não tem autorização para usar esse comando.");
return true;
}
else
{
if (PlayerInfo[playerid][pAdmin] >= 1342)
{
new para1;
new level;
if(sscanf(params, "ud", para1, level))
{
SendClientMessage(playerid, COR_GRAD2, "{0099ff}×{ffffff} USE: /criaradmin [ id ] [Level 0 á 1342]");
return true;
}
VagaAdmins();
if(VagasLivresAdm == 0)
{
SendClientMessage(playerid, COR_GRAD1, "Não há mais vagas na lista use /limparadmin primeiro.");
return 1;
}
if (level == 0)
{
SendClientMessage(playerid, COR_GRAD2, "{0099ff}×{ffffff} USE: /limparadmin para limpar uma vaga");
return 1;
}
GetPlayerName(para1, giveplayerZCMD, sizeof(giveplayerZCMD));
GetPlayerName(playerid, sendername, sizeof(sendername));
if (IsPlayerConnected(para1))
{
if (para1 != INVALID_PLAYER_ID)
{
if (PlayerInfo[para1][pAdmin] >= 1342)
{
SendClientMessage(playerid, COR_GRAD1, "Você não pode promover um admin Dono/Scripter!");
format(stringZCMD, sizeof(stringZCMD), "O admin %s tentou te promover a nivel %d", sendername, level);
SendClientMessage(para1, COR_SONS, stringZCMD);
return 1;
}
if (PlayerInfo[playerid][pAdmin] == 1340)
{
if (level > 0 || level < 1339)
{
SendClientMessage(playerid, COR_GRAD1, "Você só pode promover até cargo 4");
return 1;
}
}
if (PlayerInfo[playerid][pAdmin] == 1341)
{
if (level > 0 || level < 133
{
SendClientMessage(playerid, COR_GRAD1, "Você só pode promover até cargo 4");
return 1;
}
}
new string[128];
format(stringZCMD, sizeof(stringZCMD), " Você foi promovido para level %d de Admin - pelo dono %s.", level, sendername);
SendClientMessage(para1, COR_LIGHTBLUE, stringZCMD);
format(stringZCMD, sizeof(stringZCMD), " Você promoveu o(a) %s para o level %d de Admin.", giveplayerZCMD, level);
SendClientMessage(playerid, COR_LIGHTBLUE, stringZCMD);
getdate(year, month, day);
gettime(hour, minute, second);
format(stringZCMD, sizeof(stringZCMD), "%s deu admin nivel %d para %s [%d/%d/%d] ás [%d:%d:%d].", sendername, level, giveplayerZCMD, day, month, year, hour, minute, second);
WriteLog("Logs/comandosadmin.log", string);
printf("%s", stringZCMD);//fazendo teste
PAdminsLog(stringZCMD);
PlayerInfo[para1][pAvaliacoes] += 1;
PlayerInfo[para1][pAFinal] += 10;
for (new i = 0; i < sizeof(AdmInfo); i++)
{
if (PlayerInfo[para1][pAdmin] > 0)
{
PlayerInfo[para1][pAdmin] = level;
break;
}
else if (AdmInfo[i][AdminVaga] == 0)
{
PlayerInfo[para1][pAdmin] = level;
AdmInfo[i][AdminNick] = giveplayerZCMD;
AdmInfo[i][AdminVaga] = 1;
SalvarAdmins();
break;
}
}
}
}
}
}
return 1;
Huemerson is offline   Reply With Quote
Old 22/11/2019, 03:26 PM   #2
coool
Gangsta
 
coool's Avatar
 
Join Date: Feb 2013
Location: Republic of Pakistan
Posts: 610
Reputation: 54
Default Re: 9/5000 Help with (CMD)

https://wiki.sa-mp.com/wiki/Control_...ures#Operators
__________________
coool is online now   Reply With Quote
Old 23/11/2019, 02:20 AM   #3
Huemerson
Little Clucker
 
Huemerson's Avatar
 
Join Date: Apr 2018
Location: Brasil - Minas Gerais
Posts: 25
Reputation: 1
Default Re: 9/5000 Help with (CMD)

What I understood is that the second command ( if (PlayerInfo[playerid][pAdmin] == 1340) ), is inside the main, it has to be outside, correct?
Huemerson is offline   Reply With Quote
Old 24/11/2019, 01:11 PM   #4
Vizi10
Huge Clucker
 
Join Date: May 2017
Location: Iran
Posts: 283
Reputation: 8
Default Re: 9/5000 Help with (CMD)

Quote:
Originally Posted by Huemerson View Post
What I understood is that the second command ( if (PlayerInfo[playerid][pAdmin] == 1340) ), is inside the main, it has to be outside, correct?
If you want to check a number between two numbers and be a match you should use && not ||

pawn Code:
if(level > 0 && level < 1339) //correct
//if var between 1 and 1338

if(level > 0 || level < 1339) //worng
//if var 1 to unlimited number and upside down
Vizi10 is offline   Reply With Quote
Old 27/11/2019, 01:58 PM   #5
Huemerson
Little Clucker
 
Huemerson's Avatar
 
Join Date: Apr 2018
Location: Brasil - Minas Gerais
Posts: 25
Reputation: 1
Default Re: 9/5000 Help with (CMD)

Oops, I was actually using wrong operators, but now there is another error in Script, I will study the error and anything put here ....
Huemerson is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Ajuda] Crash em mapa criado Warning: game limit reached Entry info node pool: 5000/5000 Eutro07 Português/Portuguese 2 29/01/2019 08:17 PM
27/5000 Some Ideas for a Dialog Showerr Scripting Help 6 25/07/2018 05:29 PM
Warning: game limit reached Entry info node pool: 5000/5000 skiplovebra Server Support 0 19/07/2017 07:15 AM
[HELP] if one player dies, lose 5000$ akis_tze Help Archive 10 22/12/2009 09:17 PM
Problem with cheaters - admin lv 5000 djuro_zero Server Support 12 27/11/2008 05:26 PM


All times are GMT. The time now is 02:58 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.