SA-MP Forums Archive
What is wrong here in this code - 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: What is wrong here in this code (/showthread.php?tid=285987)



What is wrong here in this code - boyan96 - 26.09.2011

PHP код:
if (strcmp(cmdtext"/events"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
SendClientMessage(playeridCOLOR_GREEN"Events admins Online:");
            for(new 
0MAX_PLAYERSi++)
            {
                if(
IsPlayerConnected(i))
                {
                    if(
PlayerInfo[i][pEventadmin] >= 
                    
{
                        new 
sendername[MAX_PLAYER_NAME];
                        
GetPlayerName(isendernamesizeof(sendername));
                        
Message(playeridCOLOR_GREENstring);
                        }
                        else
                        {
                            
SendClientMessage(playeridCOLOR_YELLOW"*** Server Info *** : No events admins ONLINE");
                        }
                    }
                }
            }
            
SendClientMessage(playeridCOLOR_GREEN"______________");
        }
        return 
1;
 } 



Re: What is wrong here in this code - Xyrex - 26.09.2011

pawn Код:
if (strcmp(cmdtext, "/events", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new count=0;
            SendClientMessage(playerid, COLOR_GREEN, "Events admins Online:");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(PlayerInfo[i][pEventadmin] >= 1)
                    {
                        count++;
                        new sendername[MAX_PLAYER_NAME];
                        GetPlayerName(i, sendername, sizeof(sendername));
                        Message(playerid, COLOR_GREEN, string);
                    }
                }
            }
             if(count==0)
                return SendClientMessage(playerid, COLOR_YELLOW, "*** Server Info *** : No events admins ONLINE");
            SendClientMessage(playerid, COLOR_GREEN, "______________");
        }
        return 1;
 }



Re: What is wrong here in this code - boyan96 - 26.09.2011

its not only this because pawno is crash


Re: What is wrong here in this code - Xyrex - 26.09.2011

Edited.


Re: What is wrong here in this code - Rachael - 26.09.2011

If you can't see what is wrong, then I seriously doubt me debugging your script is going to help you
pawn Код:
if (strcmp(cmdtext, "/events", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            SendClientMessage(playerid, COLOR_GREEN, "Events admins Online:");
            new
                count,
                string[64]
            ;
            for(new i; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(PlayerInfo[i][pEventadmin] >= 1
                    {
                        GetPlayerName(i, string, sizeof(string));
                        format( string , sizeof(string) , "(%d) %s" , i , string );
                        SendClientMessage(playerid, COLOR_GREEN, string);
                        count++;
                    }
                }
            }
            if( !count )
            {
                SendClientMessage(playerid, COLOR_YELLOW, "*** Server Info *** : No events admins ONLINE");
            } else {
                SendClientMessage(playerid, COLOR_GREEN, "______________");
            }
        }
        return 1;
}
basically, the logic, indentation, and number of braces in this piece of code is completely wrong.


good luck


Re: What is wrong here in this code - Jafet_Macario - 26.09.2011

Quote:
Originally Posted by boyan96
Посмотреть сообщение
its not only this because pawno is crash
https://sampforum.blast.hk/showthread.php?tid=171429


Re: What is wrong here in this code - boyan96 - 26.09.2011

C:\Users\User\Desktop\ss.pwn(11619) : error 017: undefined symbol "Message"
11619>>>>> Message(playerid, COLOR_GREEN, string);


Re: What is wrong here in this code - Jafet_Macario - 26.09.2011

pawn Код:
#define Message SendClientMessage
or
pawn Код:
SendClientMessage(playerid, COLOR_GREEN, string);



Re: What is wrong here in this code - boyan96 - 26.09.2011

its works but didn't show online events admins