SA-MP Forums Archive
compile error - 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: compile error (/showthread.php?tid=512660)



compile error - zachemicals - 11.05.2014

Код:
C:\Users\user\Documents\cnr\gamemodes\cnr.pwn(2172) : error 017: undefined symbol "pname"
C:\Users\user\Documents\cnr\gamemodes\cnr.pwn(2172) : error 017: undefined symbol "pname"
C:\Users\user\Documents\cnr\gamemodes\cnr.pwn(2172) : error 029: invalid expression, assumed zero
C:\Users\user\Documents\cnr\gamemodes\cnr.pwn(2172) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
line:
Код:
2172:   GetPlayerName(playerid,pname,sizeof(pname));
	format(string,sizeof(string),"%s(%d) Has joined %s v%s.",pname,playerid,svname,sversion);
	SendClientMessageToAll(COLOR_DEADCONNECT,string);
	format(string,sizeof(string),"6%s(%d) Has joined %s v%s.",pname,playerid,svname,sversion);
	IRC_Say(gGroupID,IRC_CHANNEL,string);
	SetPlayerColor(playerid,COLOR_DEADCONNECT);



Re: compile error - NoSoap - 11.05.2014

Have you defined 'pname' at all anywhere in your defines?

Does it actually have a function? Otherwise it's not really needed.


Re: compile error - Bingo - 11.05.2014

Ah,

pawn Код:
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(MAX_PLAYER_NAME));



Re: compile error - iZN - 11.05.2014

Quote:
Originally Posted by Bingo
Посмотреть сообщение
Ah,

pawn Код:
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(MAX_PLAYER_NAME));
sizeof(pname)* or just MAX_PLAYER_NAME, you can't use sizeof for define.


Re: compile error - MasonSFW - 12.05.2014

new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(MAX_PLAYER_NAME));

Use it


Re: compile error - zachemicals - 12.05.2014

pawn Код:
new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string,sizeof(string),"%s(%d) Has joined %s v%s.",pname,playerid,svname,sversion);
    SendClientMessageToAll(COLOR_DEADCONNECT,string);
    format(string,sizeof(string),"6%s(%d) Has joined %s v%s.",pname,playerid,svname,sversion);
    IRC_Say(gGroupID,IRC_CHANNEL,string);
    SetPlayerColor(playerid,COLOR_DEADCONNECT);
now i'm getting
pawn Код:
C:\Users\user\Documents\cnr\gamemodes\cnr.pwn(2174) : error 017: undefined symbol "string"
C:\Users\user\Documents\cnr\gamemodes\cnr.pwn(2174) : error 017: undefined symbol "string"
C:\Users\user\Documents\cnr\gamemodes\cnr.pwn(2174) : error 029: invalid expression, assumed zero
C:\Users\user\Documents\cnr\gamemodes\cnr.pwn(2174) : 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.
pawn Код:
format(string,sizeof(string),"%s(%d) Has joined %s v%s.",pname,playerid,svname,sversion);



Re: compile error - Infinitas - 12.05.2014

so add

new string[128];


Re: compile error - Lynn - 12.05.2014

pawn Код:
new pname[MAX_PLAYER_NAME], string[128+MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string,sizeof(string),"%s(%d) Has joined %s v%s.",pname,playerid,svname,sversion);
    SendClientMessageToAll(COLOR_DEADCONNECT,string);
    format(string,sizeof(string),"6%s(%d) Has joined %s v%s.",pname,playerid,svname,sversion);
    IRC_Say(gGroupID,IRC_CHANNEL,string);
    SetPlayerColor(playerid,COLOR_DEADCONNECT);



Re : compile error - Ramoboss - 12.05.2014

Dude, it's a Copy / Paste code, try to be more standalone,
when you have an Undefined Symbol error, try to Define the symbol,
and you can figur it out with your own,

for exemple, Undefined Symbol "string" : new string[128];

or pname :
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));

or
Undefined Symbol "PoliceCar"
new PoliceCar;