PDA

View Full Version : my 101st thread!*celebration*


n00blek
25/09/2017, 04:18 PM
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)


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_STY LE_MSGBOX,""COL_BLUE"Aktivni lideri:",str,"Ok","");
}
}
return 1;
}


C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\AdminPlugin.pwn(474) : error 012: invalid function call, not a valid address
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\AdminPlugin.pwn(474) : warning 215: expression has no effect
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\AdminPlugin.pwn(474) : error 001: expected token: ";", but found ")"
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\AdminPlugin.pwn(474) : error 029: invalid expression, assumed zero
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\AdminPlugin.pwn(474) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.

Sew_Sumi
25/09/2017, 04:23 PM
Highlighting the actual line the error occurs on would help.

n00blek
25/09/2017, 04:24 PM
OK did it

coool
25/09/2017, 04:33 PM
Not the extra comma after COL_RED

J0sh...
25/09/2017, 04:34 PM
format does not take a colour.
format(str,sizeof(str),"%s | %s |",orgname,name(i));

n00blek
25/09/2017, 04:38 PM
still same errors

Fratello
25/09/2017, 04:59 PM
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. 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 http://wiki.sa-mp.com/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)));

Marricio
25/09/2017, 05:33 PM
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);

Kraeror
25/09/2017, 06:20 PM
Here you are bro:
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(i, name, MAX_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_STY LE_MSGBOX,""COL_BLUE"Aktivni lideri:",str,"Ok","");
}
}
return 1;
}
+1 REP if I helped you :)

n00blek
25/09/2017, 06:53 PM
Here you are bro:
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(i, name, MAX_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_STY LE_MSGBOX,""COL_BLUE"Aktivni lideri:",str,"Ok","");
}
}
return 1;
}
+1 REP if I helped you :)


1 warning left:

C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\AdminPlugin.pwn(474) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.

Sew_Sumi
25/09/2017, 06:58 PM
1 warning left:

C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\AdminPlugin.pwn(474) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.



That's the whitespace before the beginning of the line not being neat.

Just wipe out the whitespace, and use tab to take the beginning of the line out to where it should be.

n00blek
25/09/2017, 07:03 PM
That's the whitespace before the beginning of the line not being neat.

Just wipe out the whitespace, and use tab to take the beginning of the line out to where it should be.

omg im so stupid ahahah!
+rep for everyone!