Undefined symbol: player1
#1

Hey guys I am making a textdraw to get player score, money, kills, deaths.

What I use:

PHP Code:
Web = TextDrawCreate(485.000000, 10.000000, "Scores: %d | Money: $%d | Kills: %d | Deaths: %d | K/D Ratio: %0.2f", GetPlayerScore(playerid), GetPlayerScore(player1), GetPlayerMoney(player1), PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:pDeaths);
    
TextDrawBackgroundColor(Web, 255);
    
TextDrawFont(Web, 3);
    
TextDrawLetterSize(Web, 0.330000, 1.200000);
    
TextDrawColor(Web, -1);
    
TextDrawSetOutline(Web, 1);
    
TextDrawSetProportional(Web, 1);
    
TextDrawSetShadow(Web,1); 
Error:

PHP Code:
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(1464) : error 017: undefined symbol "playerid" 
I also used it with a command (/stats):

PHP Code:
#if defined USE_STATS
CMD:stats(playerid,params[]) {
    new 
string[100], pDeaths, player1, h, m, s,playername[MAX_PLAYER_NAME];
    if(
isnull(params)) player1 = playerid;
    else 
player1 = strval(params);
    if(
IsPlayerConnected(player1)) {
        
TotalGameTime(player1, h, m, s);
        
GetPlayerName(player1, playername, sizeof(playername));
         if(
PlayerInfo[player1][Deaths] == 0) pDeaths = 1; else pDeaths = PlayerInfo[player1][Deaths];
         new 
str[120], str1[100], str2[100];
         
format(str, sizeof(str),"| ------ | %s's Status | ------- |", PlayerName2(player1));
        
format(string,sizeof(string),"Scores: %d | Money: $%d | Kills: %d | Deaths: %d | K/D Ratio: %0.2f", GetPlayerScore(player1), GetPlayerMoney(player1), PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:pDeaths);
        
format(str1, sizeof(str1),"Admin Level: %d | Moderator: %s | Rank: %s | Team: %s | Class: %s", PlayerInfo[player1][Level], PlayerInfo[player1][Helper] ? ("Yes") : ("No"), GetRankName(player1), GetTeamName(player1), GetClass(player1));
        
format(str2, sizeof(str2),"TimePlayed: [%d] hrs [%d] mins [%d] secs", h, m, s);
        
SendClientMessage(playerid, 0xFFFFFFFF,str);
        
SendClientMessage(playerid, 0xAAAAAAFF,string);
        
SendClientMessage(playerid, 0xAAAAAAFF,str1);
        
SendClientMessage(playerid, 0xAAAAAAFF,str2);
        
SendClientMessage(playerid, 0xFFFFFFFF,"| ---------------------------------------------------- |");
    } else return 
SendClientMessage(playerid, red, "Player Not Connected!");
    return 
1;
}
#endif 
HELP !
Reply
#2

I fixed it:
PHP Code:
Web = TextDrawCreate(485.000000, 10.000000, "Scores: %d | Money: $%d | Kills: %d | Deaths: %d | K/D Ratio: %0.2f", GetPlayerScore(player1), GetPlayerScore(player1), GetPlayerMoney(player1), PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:pDeaths); 
Well, can you tell me which callback this is and where you defined 'player1'?
Reply
#3

I think I don't defined it, but I used player1 so many times in my script...
Reply
#4

Which callback is this? OnGameModeInit?
Reply
#5

1 sec
Reply
#6

Callback: OnGameModeInit
Reply
#7

Then, this won't work. I'll post the new code, wait.
Reply
#8

Yeah great thankyou
Reply
#9

Add this on top of your script:
PHP Code:
new Text:Web[MAX_PLAYERS]; 
In OnGameModeInit:
PHP Code:
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        
Web[i] = TextDrawCreate(485.000000, 10.000000, "_"); 
        
TextDrawBackgroundColor(Web[i], 255); 
        
TextDrawFont(Web[i], 3); 
        
TextDrawLetterSize(Web[i], 0.330000, 1.200000); 
        
TextDrawColor(Web[i], -1); 
        
TextDrawSetOutline(Web[i], 1); 
        
TextDrawSetProportional(Web[i], 1); 
        
TextDrawSetShadow(Web[i],1); 
And under OnPlayerSpawn:
PHP Code:
new string[128];
format(string, sizeof(string), "Scores: %d | Money: $%d | Kills: %d | Deaths: %d | K/D Ratio: %0.2f", GetPlayerScore(playerid), GetPlayerScore(playerid), GetPlayerMoney(playerid), PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths], Float:PlayerInfo[playerid][Kills]/Float:pDeaths);
TextDrawSetString(Web[playerid], string);
TextDrawShowForPlayer(playerid, Web[playerid]); 
Reply
#10

Quote:
Originally Posted by ATGOggy
View Post
Add this on top of your script:
PHP Code:
new Text:Web[MAX_PLAYERS]; 
In OnGameModeInit:
PHP Code:
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        
Web[i] = TextDrawCreate(485.000000, 10.000000, "_"); 
        
TextDrawBackgroundColor(Web[i], 255); 
        
TextDrawFont(Web[i], 3); 
        
TextDrawLetterSize(Web[i], 0.330000, 1.200000); 
        
TextDrawColor(Web[i], -1); 
        
TextDrawSetOutline(Web[i], 1); 
        
TextDrawSetProportional(Web[i], 1); 
        
TextDrawSetShadow(Web[i],1); 
And under OnPlayerSpawn:
PHP Code:
new string[128];
format(string, sizeof(string), "Scores: %d | Money: $%d | Kills: %d | Deaths: %d | K/D Ratio: %0.2f", GetPlayerScore(playerid), GetPlayerScore(playerid), GetPlayerMoney(playerid), PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths], Float:PlayerInfo[playerid][Kills]/Float:pDeaths);
TextDrawSetString(Web[playerid], string);
TextDrawShowForPlayer(playerid, Web[playerid]); 
errors:

PHP Code:
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(406) : error 021: symbol already defined: "Web"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(1701) : error 079: inconsistent return types (array & non-array)
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(1707) : error 079: inconsistent return types (array & non-array)
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(1713) : error 079: inconsistent return types (array & non-array)
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(1719) : error 079: inconsistent return types (array & non-array)
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(1721) : error 017: undefined symbol "UpdateConfig"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2118) : warning 219: local variable "i" shadows a variable at a preceding level
C
:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2118) : error 004: function "Itter_OnPlayerConnect" is not implemented
C
:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2119) : warning 219: local variable "i" shadows a variable at a preceding level
C
:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2120) : warning 219: local variable "i" shadows a variable at a preceding level
C
:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2122) : error 079: inconsistent return types (array & non-array)
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2125) : error 029: invalid expression, assumed zero
C
:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2125) : error 004: function "OnPlayerCleoDetected" is not implemented
C
:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2127) : error 017: undefined symbol "cleoid"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2131) : error 017: undefined symbol "playerid"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2135) : error 017: undefined symbol "playerid"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2139) : error 017: undefined symbol "playerid"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2142) : error 079: inconsistent return types (array & non-array)
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2144) : warning 225: unreachable code
C
:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2144) : error 029: invalid expression, assumed zero
C
:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2144) : error 017: undefined symbol "IsPlayerInArea"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2148) : error 017: undefined symbol "playerid"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2149) : error 017: undefined symbol "MinX"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2150) : error 079: inconsistent return types (array & non-array)
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2152) : error 079: inconsistent return types (array & non-array)
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2180) : warning 225: unreachable code
C
:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2180) : error 029: invalid expression, assumed zero
C
:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2180) : error 004: function "OnFilterScriptExit" is not implemented
C
:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2183) : error 004: function "SaveStats" is not implemented
C
:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2185) : error 017: undefined symbol "DestroyAllMenus"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2187) : error 079: inconsistent return types (array & non-array)
Compilation aborted.Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase
26 Errors
. 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)