SA-MP Forums Archive
my 101st thread!*celebration* - 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: my 101st thread!*celebration* (/showthread.php?tid=642148)



my 101st thread!*celebration* - n00blek - 25.09.2017

sorry for stupid titles. gotta bring views
but so true i made at least 100 of those.
got some errors. some of them are obvious some arent.(100th bug!! i solved 3 times more of them so you wont think that im here just for you to fix things for me. i simply dont know. thats why my name is n00blek)

PHP код:
CMD:lideri(playerid,params[])
{
    for(new 
i=0;i<MAX_PLAYERS;i++)
    {
        if(
PlayerInfo[i][pRank] == 6)
        {
              new 
str[512],orgname[24],name[24];
            if(
PlayerInfo[i][pOrgID] == 1) { orgname "Grove Street Families"; }
---->            
format(str,sizeof(str),COL_RED,"%s | %s |",orgname,name(i));
            
ShowPlayerDialog(playerid,DIALOG_LIDERI,DIALOG_STYLE_MSGBOX,""COL_BLUE"Aktivni lideri:",str,"Ok","");
        }
    }
    return 
1;

PHP код:
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\AdminPlugin.pwn(474) : error 012invalid function callnot a valid address
C
:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\AdminPlugin.pwn(474) : warning 215expression has no effect
C
:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\AdminPlugin.pwn(474) : error 001expected token";"but found ")"
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\AdminPlugin.pwn(474) : error 029invalid expressionassumed zero
C
:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\AdminPlugin.pwn(474) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
4 Errors




Re: my 101st thread!*celebration* - Sew_Sumi - 25.09.2017

Highlighting the actual line the error occurs on would help.


Re: my 101st thread!*celebration* - n00blek - 25.09.2017

OK did it


Re: my 101st thread!*celebration* - coool - 25.09.2017

Not the extra comma after COL_RED


Re: my 101st thread!*celebration* - J0sh... - 25.09.2017

format does not take a colour.
PHP код:
format(str,sizeof(str),"%s | %s |",orgname,name(i)); 



Re: my 101st thread!*celebration* - n00blek - 25.09.2017

still same errors


Re: my 101st thread!*celebration* - Fratello - 25.09.2017

Try to learn from your mistakes (color doesn't fit format params).

Hmm, let's see.
Код:
 if(PlayerInfo[i][pOrgID] == 1) { orgname = "Grove Street Families"; }
Those two brackets are not necessary.
Quote:

if(PlayerInfo[i][pOrgID] == 1) orgname = "Grove Street Families";

So, (i) is causing the problem. Script doesn't know what i means. If you're trying to get the players name visit https://sampwiki.blast.hk/wiki/GetPlayerName You have a clear example how to implement it!

Duhh, here you go!

Код:
 new str[512],orgname[24],name[MAX_PLAYER_NAME];
           format(str,sizeof(str),"%s | %s |",orgname, GetPlayerName(playerid, name, sizeof(name)));



Re: my 101st thread!*celebration* - Marricio - 25.09.2017

This is the correct way to get a player's name:
Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(str,sizeof(str),"%s | %s |",orgname, name);



Re: my 101st thread!*celebration* - Kraeror - 25.09.2017

Here you are bro:
PHP код:
CMD:lideri(playerid,params[]) 

    for(new 
i=0;i<MAX_PLAYERS;i++) 
    { 
        if(
PlayerInfo[i][pRank] == 6
        { 
              new 
str[512],orgname[24],name[MAX_PLAYER_NAME]; 
              
GetPlayerName(inameMAX_PLAYER_NAME);
            if(
PlayerInfo[i][pOrgID] == 1) { orgname "Grove Street Families"; } 
---->            
format(str,sizeof(str),COL_RED,"%s | %s |",orgname,name); 
            
ShowPlayerDialog(playerid,DIALOG_LIDERI,DIALOG_STYLE_MSGBOX,""COL_BLUE"Aktivni lideri:",str,"Ok",""); 
        } 
    } 
    return 
1

+1 REP if I helped you


Re: my 101st thread!*celebration* - n00blek - 25.09.2017

Quote:
Originally Posted by Kraeror
Посмотреть сообщение
Here you are bro:
PHP код:
CMD:lideri(playerid,params[]) 

    for(new 
i=0;i<MAX_PLAYERS;i++) 
    { 
        if(
PlayerInfo[i][pRank] == 6
        { 
              new 
str[512],orgname[24],name[MAX_PLAYER_NAME]; 
              
GetPlayerName(inameMAX_PLAYER_NAME);
            if(
PlayerInfo[i][pOrgID] == 1) { orgname "Grove Street Families"; } 
---->            
format(str,sizeof(str),COL_RED,"%s | %s |",orgname,name); 
            
ShowPlayerDialog(playerid,DIALOG_LIDERI,DIALOG_STYLE_MSGBOX,""COL_BLUE"Aktivni lideri:",str,"Ok",""); 
        } 
    } 
    return 
1

+1 REP if I helped you
1 warning left:
PHP код:
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\AdminPlugin.pwn(474) : warning 217loose indentation
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
1 Warning