I TYPE A COMMAND AND NOTHING HAPPENS! *REP+* - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: I TYPE A COMMAND AND NOTHING HAPPENS! *REP+* (
/showthread.php?tid=602918)
I TYPE A COMMAND AND NOTHING HAPPENS! *REP+* -
_GHT_MarK445 - 15.03.2016
Hey guys, i need help. I made myself an /admins command, which is supposed to show online admins and when there is no admin, it is supposed to show an dialog with no admins online, there is a code:
Код:
CMD:admins(playerid, params[])
{
new string[128];
new str[128];
new Admin[50];
if(PlayerInfo[playerid][pAdmin] == 2) Admin = "Moderбtor";
if(PlayerInfo[playerid][pAdmin] == 3) Admin = "Administrбtor";
if(PlayerInfo[playerid][pAdmin] == 4) Admin = "Vedъci Administrбtor";
if(PlayerInfo[playerid][pAdmin] == 5) Admin = "Hlavnэ Administrбtor";
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i) && PlayerInfo[i][pAdmin] > 0)
{
format(str, sizeof(str), "%s (%d) {FF0000}%s", GetName(i), i, Admin);
strcat(string, str);
ShowPlayerDialog(playerid, DIALOG_ADMINS, DIALOG_STYLE_LIST, "Administrбtori", string, "Vybrať", "Zavrieť");
}
if(!IsPlayerConnected(i) && PlayerInfo[i][pAdmin] > 0)
{
ShowPlayerDialog(playerid, DIALOG_NOADMINS, DIALOG_STYLE_MSGBOX, "Administrбtori", "Na servery nieje prнtomnэ ћiadny administrбtor", "Zavrieť", "");
}
}
return 1;
}
When i write a command, simply nothing happens, even if it would be a wrong command, it should show a note, i am using zcmd, so the command performs, but with no content.
If one of you guys would solve this problem for me, you will earn REP+.
Re: I TYPE A COMMAND AND NOTHING HAPPENS! *REP+* -
YouServ - 15.03.2016
strcat is useless, you need to remove your condition of for
PHP код:
CMD:admins(playerid, params[])
{
new str[128];
new Admin[50];
new adminsOnline;
if(PlayerInfo[playerid][pAdmin] == 2) Admin = "Moderбtor";
if(PlayerInfo[playerid][pAdmin] == 3) Admin = "Administrбtor";
if(PlayerInfo[playerid][pAdmin] == 4) Admin = "Vedъci Administrбtor";
if(PlayerInfo[playerid][pAdmin] == 5) Admin = "Hlavnэ Administrбtor";
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i) && PlayerInfo[i][pAdmin] > 0)
{
adminsOnline++;
format(str, sizeof(str), "%s (%d) {FF0000}%s", GetName(i), i, Admin);
ShowPlayerDialog(playerid, DIALOG_ADMINS, DIALOG_STYLE_LIST, "Administrбtori", str, "Vybrať", "Zavrieť");
}
}
if(adminsOnline == 0) ShowPlayerDialog(playerid, DIALOG_NOADMINS, DIALOG_STYLE_MSGBOX, "Administrбtori", "Na servery nieje prнtomnэ ћiadny administrбtor", "Zavrieť", "");
return 1;
}
Re: I TYPE A COMMAND AND NOTHING HAPPENS! *REP+* -
_GHT_MarK445 - 15.03.2016
Thanks buddy, as i promised REP+.