Error Messages on public OnPlayerUpdate(playerid)
#1

So the code sends me a bunch of undefined symbols, Im not sure how to end it correctly any help?
Код:
public OnPlayerUpdate(playerid)
{
	// Do not put heavy cpu checks in here. Use the 1 second timer.
	if(playerTabbed[playerid] == 1)
	{
		playerTabbed[playerid] = 0;
		playerTabbedTime[playerid] = 0;
	}
	playerSeconds[playerid] = gettime();

	if(GetPVarInt(playerid, "Injured") == 1) SetPlayerArmedWeapon(playerid, 0);
	if(GetPVarInt(playerid, "IsFrozen") == 1) TogglePlayerControllable(playerid, 0);

	new pCurWeap = GetPlayerWeapon(playerid);
    if(pCurWeap != pCurrentWeapon[playerid])
    {
        OnPlayerChangeWeapon(playerid, pCurWeap);
        pCurrentWeapon[playerid] = pCurWeap;
	}
}
return 1;
}
Reply
#2

The problem is that you did not initialize variables playerTabbed, playerTabbedTime, playerSeconds, pCurrentWeapon anywhere. Plus, it is highly recommended that you don't use procedures like that one in OnPlayerUpdate callback, because it will result in server lag.
Reply
#3

Quote:
Originally Posted by Pupak
Посмотреть сообщение
The problem is that you did not initialize variables playerTabbed, playerTabbedTime, playerSeconds, pCurrentWeapon anywhere. Plus, it is highly recommended that you don't use procedures like that one in OnPlayerUpdate callback, because it will result in server lag.
Thats not the problem they are used in other lines it sends me these errors
Код:
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4070) : error 017: undefined symbol "ProxDetector"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4077) : error 017: undefined symbol "ProxDetector"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4084) : error 017: undefined symbol "ProxDetector"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4093) : error 017: undefined symbol "ProxDetector"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4107) : error 017: undefined symbol "ProxDetector"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4114) : error 017: undefined symbol "ProxDetector"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4118) : error 017: undefined symbol "GivePlayerCash"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4121) : error 017: undefined symbol "ProxDetector"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4128) : error 017: undefined symbol "ProxDetector"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4136) : error 017: undefined symbol "GivePlayerCash"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4139) : error 017: undefined symbol "ProxDetector"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4146) : error 017: undefined symbol "ProxDetector"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4153) : error 017: undefined symbol "ProxDetector"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4161) : error 017: undefined symbol "GivePlayerCash"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4166) : error 017: undefined symbol "ProxDetector"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4175) : error 017: undefined symbol "ProxDetector"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4187) : error 017: undefined symbol "ProxDetector"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4206) : error 017: undefined symbol "ProxDetector"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4220) : error 017: undefined symbol "ProxDetector"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4228) : error 017: undefined symbol "GivePlayerCash"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4233) : error 017: undefined symbol "ProxDetector"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4241) : error 017: undefined symbol "GivePlayerCash"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4246) : error 017: undefined symbol "ProxDetector"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4265) : error 017: undefined symbol "GivePlayerCash"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4272) : error 017: undefined symbol "GivePlayerCash"
C:\Users\Felipe\Desktop\SA-MP Stuff\San Andreas Generation Roleplay\gamemodes\NERP.pwn(4279) : error 017: undefined symbol "GivePlayerCash"

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


26 Errors.
Reply
#4

Last line has an extra closing brace and return 1; is in the wrong spot.

Also.... don't use PVars in OnPlayerUpdate()
Reply
#5

Код:
new ProxDetector, GivePlayerCash;
Код:
public OnPlayerUpdate(playerid)
{
	// Do not put heavy cpu checks in here. Use the 1 second timer.
        new ProxDetector, GivePlayerCash;
	if(playerTabbed[playerid] == 1)
	{
		playerTabbed[playerid] = 0;
		playerTabbedTime[playerid] = 0;
	}
	playerSeconds[playerid] = gettime();

	if(GetPVarInt(playerid, "Injured") == 1) SetPlayerArmedWeapon(playerid, 0);
	if(GetPVarInt(playerid, "IsFrozen") == 1) TogglePlayerControllable(playerid, 0);

	new pCurWeap = GetPlayerWeapon(playerid);
    if(pCurWeap != pCurrentWeapon[playerid])
    {
        OnPlayerChangeWeapon(playerid, pCurWeap);
        pCurrentWeapon[playerid] = pCurWeap;
	}
}
return 1;
}
Reply
#6

Delete the bracket } before return 1;
Reply
#7

Here is the ProxDetector
pawn Код:
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
//==============================================================================
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
            {
                GetPlayerPos(i, posx, posy, posz);
                tempposx = (oldposx -posx);
                tempposy = (oldposy -posy);
                tempposz = (oldposz -posz);
                if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) // If the player is within 16 meters
                {
                    SendClientMessage(i, col1, string);
                }
                else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) // within 8 meters
                {
                    SendClientMessage(i, col2, string);
                }
                else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) //4 meters
                {
                    SendClientMessage(i, col3, string);
                }
                else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) //2 meters
                {
                    SendClientMessage(i, col4, string);
                }
                else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) //1 meter
                {
                    SendClientMessage(i, col5, string);
                }
            }
            else
            {
                SendClientMessage(i, col1, string);
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)