my 101st thread!*celebration*
#1

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

Reply
#2

Highlighting the actual line the error occurs on would help.
Reply
#3

OK did it
Reply
#4

Not the extra comma after COL_RED
Reply
#5

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

still same errors
Reply
#7

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)));
Reply
#8

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);
Reply
#9

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
Reply
#10

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

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)