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.00000010.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(Web255);
    
TextDrawFont(Web3);
    
TextDrawLetterSize(Web0.3300001.200000);
    
TextDrawColor(Web, -1);
    
TextDrawSetOutline(Web1);
    
TextDrawSetProportional(Web1);
    
TextDrawSetShadow(Web,1); 
Error:

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

PHP Code:
#if defined USE_STATS
CMD:stats(playerid,params[]) {
    new 
string[100], pDeathsplayer1hms,playername[MAX_PLAYER_NAME];
    if(
isnull(params)) player1 playerid;
    else 
player1 strval(params);
    if(
IsPlayerConnected(player1)) {
        
TotalGameTime(player1hms);
        
GetPlayerName(player1playernamesizeof(playername));
         if(
PlayerInfo[player1][Deaths] == 0pDeaths 1; else pDeaths PlayerInfo[player1][Deaths];
         new 
str[120], str1[100], str2[100];
         
format(strsizeof(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(str1sizeof(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(str2sizeof(str2),"TimePlayed: [%d] hrs [%d] mins [%d] secs"hms);
        
SendClientMessage(playerid0xFFFFFFFF,str);
        
SendClientMessage(playerid0xAAAAAAFF,string);
        
SendClientMessage(playerid0xAAAAAAFF,str1);
        
SendClientMessage(playerid0xAAAAAAFF,str2);
        
SendClientMessage(playerid0xFFFFFFFF,"| ---------------------------------------------------- |");
    } else return 
SendClientMessage(playeridred"Player Not Connected!");
    return 
1;
}
#endif 
HELP !
Reply
#2

I fixed it:
PHP Code:
Web TextDrawCreate(485.00000010.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.00000010.000000"_"); 
        
TextDrawBackgroundColor(Web[i], 255); 
        
TextDrawFont(Web[i], 3); 
        
TextDrawLetterSize(Web[i], 0.3300001.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(stringsizeof(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(playeridWeb[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.00000010.000000"_"); 
        
TextDrawBackgroundColor(Web[i], 255); 
        
TextDrawFont(Web[i], 3); 
        
TextDrawLetterSize(Web[i], 0.3300001.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(stringsizeof(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(playeridWeb[playerid]); 
errors:

PHP Code:
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(406) : error 021symbol already defined"Web"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(1701) : error 079inconsistent return types (array & non-array)
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(1707) : error 079inconsistent return types (array & non-array)
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(1713) : error 079inconsistent return types (array & non-array)
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(1719) : error 079inconsistent return types (array & non-array)
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(1721) : error 017undefined symbol "UpdateConfig"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2118) : warning 219local 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 219local variable "i" shadows a variable at a preceding level
C
:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2120) : warning 219local variable "i" shadows a variable at a preceding level
C
:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2122) : error 079inconsistent return types (array & non-array)
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2125) : error 029invalid expressionassumed 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 017undefined symbol "cleoid"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2131) : error 017undefined symbol "playerid"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2135) : error 017undefined symbol "playerid"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2139) : error 017undefined symbol "playerid"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2142) : error 079inconsistent return types (array & non-array)
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2144) : warning 225unreachable code
C
:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2144) : error 029invalid expressionassumed zero
C
:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2144) : error 017undefined symbol "IsPlayerInArea"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2148) : error 017undefined symbol "playerid"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2149) : error 017undefined symbol "MinX"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2150) : error 079inconsistent return types (array & non-array)
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2152) : error 079inconsistent return types (array & non-array)
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2180) : warning 225unreachable code
C
:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2180) : error 029invalid expressionassumed 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 017undefined symbol "DestroyAllMenus"
C:\Users\Administrator\Desktop\ProjectSvT\gamemodes\SvTMike.pwn(2187) : error 079inconsistent return types (array & non-array)
Compilation aborted.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
26 Errors

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)