Undefined symbol playerid..
#1

Code:
if(pInfo[playerid][pLoggedIn] == 1)
	{   
		new score = GetPlayerScore(playerid);
		new money = GetPlayerMoney(playerid);
	    new query[256];
	    format(query, 256, "UPDATE `playerdata` SET `score` = '%d', `kills` = '%d', `deaths` = '%d', `admin` = '%d', `VIP` = '%d', `money` = '%d', `pjobselected` = '1', `pjob` ='%d' WHERE `id` = '%d'", score, pInfo[playerid][pKills], pInfo[playerid][pDeaths], pInfo[playerid][pAdmin], pInfo[playerid][pVIP], money, pInfo[playerid][pJob], pInfo[playerid][pDBID]);
		mysql_tquery(dbHandle, query); // thats it
	}
	return 1;
ERRORS
Code:
C:\Users\div\Desktop\samp\gamemodes\CNR.pwn(684) : error 017: undefined symbol "playerid"
C:\Users\div\Desktop\samp\gamemodes\CNR.pwn(686) : error 017: undefined symbol "playerid"
C:\Users\div\Desktop\samp\gamemodes\CNR.pwn(687) : error 017: undefined symbol "playerid"
C:\Users\div\Desktop\samp\gamemodes\CNR.pwn(689) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

I've tried adding this code =
Code:
new playerid = GetPlayerName(playerid);
then it gives me warning

Code:
C:\Users\div\Desktop\samp\gamemodes\CNR.pwn(683) : warning 202: number of arguments does not match definition
C:\Users\div\Desktop\samp\gamemodes\CNR.pwn(683) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Reply
#2

Quote:
Originally Posted by div
View Post
Code:
if(pInfo[playerid][pLoggedIn] == 1)
	{   
		new score = GetPlayerScore(playerid);
		new money = GetPlayerMoney(playerid);
	    new query[256];
	    format(query, 256, "UPDATE `playerdata` SET `score` = '%d', `kills` = '%d', `deaths` = '%d', `admin` = '%d', `VIP` = '%d', `money` = '%d', `pjobselected` = '1', `pjob` ='%d' WHERE `id` = '%d'", score, pInfo[playerid][pKills], pInfo[playerid][pDeaths], pInfo[playerid][pAdmin], pInfo[playerid][pVIP], money, pInfo[playerid][pJob], pInfo[playerid][pDBID]);
		mysql_tquery(dbHandle, query); // thats it
	}
	return 1;
ERRORS
Code:
C:\Users\div\Desktop\samp\gamemodes\CNR.pwn(684) : error 017: undefined symbol "playerid"
C:\Users\div\Desktop\samp\gamemodes\CNR.pwn(686) : error 017: undefined symbol "playerid"
C:\Users\div\Desktop\samp\gamemodes\CNR.pwn(687) : error 017: undefined symbol "playerid"
C:\Users\div\Desktop\samp\gamemodes\CNR.pwn(689) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

I've tried adding this code =
Code:
new playerid = GetPlayerName(playerid);
then it gives me warning

Code:
C:\Users\div\Desktop\samp\gamemodes\CNR.pwn(683) : warning 202: number of arguments does not match definition
C:\Users\div\Desktop\samp\gamemodes\CNR.pwn(683) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
You don't need that code. Take that out. That's why you having error cause of that 1 code.
Reply
#3

You sure you have added that to OnPlayerConnect? Because it seems like its under OnGameModeInit otherwise playerid variable would not get this error.
Reply
#4

As GTLS said you can put that to OnPlayerConnect


here's the wiki of get playername for you to understand what it is
https://sampwiki.blast.hk/wiki/GetPlayerName
Reply
#5

playerid is not player name
Reply
#6

Code:
new playerid = GetPlayerName(playerid);
First of all this is not correct, If you want to store the name it must be,

Code:
new plname = GetPlayerName(playerid, plname);
and if playerid not working try spareid, or playerID, and if you have discord, let me know i will help you there!
Reply
#7

Quote:
Originally Posted by SubGames
View Post
Code:
new playerid = GetPlayerName(playerid);
First of all this is not correct, If you want to store the name it must be,

Code:
new plname = GetPlayerName(playerid, plname);
and if playerid not working try spareid, or playerID, and if you have discord, let me know i will help you there!
what about the length??

GetPlayerName(playerid, const name[], len);

PHP Code:
new plname[24];
GetPlayerName(playeridplnamesizeof(plname)); 
Reply
#8

I would recommend creating a simple function:

PHP Code:
stock GetName(playerid)
{
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnamesizeof(name));
    return 
name;

Reply
#9

But why are people suggesting him to make a get name function?? as you can see he wants to store data into MySQL DB, so he would not need name but the actual playerid. And what is spareid and playerID? playerid is the default variable in SAMP, and I dont think he changed it.

His problem was that playerid was invalid symbol and I already answered it. There's no need for rep hunting this much. If you want rep so bad, make a huge contribution instead of just barking anything that comes into your mind.
Reply
#10

It seems that you are running this satement(new score = GetPlayerScore(playerid) in a callbach who doesn't defined playerid example ( OnGameModeInit() ) so if you are doing this in OnGameModeInit() then use for.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)