SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/06/2018, 10:13 AM   #1
div
Huge Clucker
 
Join Date: Dec 2017
Location: Rajasthan ka chorra :P
Posts: 216
Reputation: 18
Default Undefined symbol playerid..

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 (c) 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 (c) 1997-2006, ITB CompuPhase
div is offline   Reply With Quote
Old 19/06/2018, 10:17 AM   #2
DerickClark
High-roller
 
Join Date: Jul 2012
Posts: 1,752
Reputation: 14
Default Re: Undefined symbol playerid..

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 (c) 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 (c) 1997-2006, ITB CompuPhase
You don't need that code. Take that out. That's why you having error cause of that 1 code.
__________________
Working on a Trucking Server from scratch.
There are cool features, like /workmenu /convoy /pay(When Police Officer asked you for a fine) and more etc.
DerickClark is offline   Reply With Quote
Old 19/06/2018, 11:25 AM   #3
GTLS
High-roller
 
GTLS's Avatar
 
Join Date: Aug 2014
Location: India
Posts: 1,072
Reputation: 119
Default Re: Undefined symbol playerid..

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

I don't help for rep. I help cuz I was helped in the past.


Retired from SAMP Scene. Might open SAMP Forums once in a while.

Some treats for ya. Click em
Basic House System
Simple Speedo
Base Login/Register Script

GTLS is offline   Reply With Quote
Old 19/06/2018, 12:56 PM   #4
Shadow0707
Big Clucker
 
Join Date: Sep 2016
Posts: 92
Reputation: 7
Default Re: Undefined symbol playerid..

As GTLS said you can put that to OnPlayerConnect


here's the wiki of get playername for you to understand what it is
http://wiki.sa-mp.com/wiki/GetPlayerName
Shadow0707 is online now   Reply With Quote
Old 19/06/2018, 01:02 PM   #5
kovac
Banned
 
Join Date: Mar 2018
Posts: 177
Reputation: 14
Default Re: Undefined symbol playerid..

playerid is not player name
kovac is offline   Reply With Quote
Old 19/06/2018, 01:45 PM   #6
SubGames
Little Clucker
 
Join Date: Jul 2016
Posts: 26
Reputation: 0
Default Re: Undefined symbol playerid..

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!
SubGames is offline   Reply With Quote
Old 19/06/2018, 01:55 PM   #7
Lokii
Huge Clucker
 
Join Date: Sep 2017
Posts: 375
Reputation: 92
Default Re: Undefined symbol playerid..

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)); 
__________________
Lokii is offline   Reply With Quote
Old 19/06/2018, 02:45 PM   #8
kovac
Banned
 
Join Date: Mar 2018
Posts: 177
Reputation: 14
Default Re: Undefined symbol playerid..

I would recommend creating a simple function:

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

kovac is offline   Reply With Quote
Old 19/06/2018, 02:57 PM   #9
GTLS
High-roller
 
GTLS's Avatar
 
Join Date: Aug 2014
Location: India
Posts: 1,072
Reputation: 119
Default Re: Undefined symbol playerid..

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.
__________________

I don't help for rep. I help cuz I was helped in the past.


Retired from SAMP Scene. Might open SAMP Forums once in a while.

Some treats for ya. Click em
Basic House System
Simple Speedo
Base Login/Register Script

GTLS is offline   Reply With Quote
Old 19/06/2018, 03:05 PM   #10
TadePoleMG
Big Clucker
 
TadePoleMG's Avatar
 
Join Date: Apr 2018
Location: Uttar Pradesh, India
Posts: 163
Reputation: 2
Default Re: Undefined symbol playerid..

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.
__________________
-| Gaming 'N' Scripting |-
TadePoleMG is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Undefined Symbol 'playerid' Need Help. Rory Server Support 1 29/06/2013 06:49 AM
Undefined Symbol: playerid admantis Help Archive 6 02/01/2011 06:15 PM
Undefined symbol, playerid? wtf! knackworst Help Archive 3 11/11/2010 04:06 PM
Undefined symbol playerid O.o FireCat Help Archive 5 16/08/2010 06:15 PM
Undefined symbol playerid FreeSoul Help Archive 8 07/10/2009 05:03 PM


All times are GMT. The time now is 03:33 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.