[ASK]SetPlayerHealth and undefinedsymbol not working
#1

Hello, before i started this topic.. i want to tell you i was use the Fahad Zombie Gamemode from here.


And the problem is..
i want to set player health -10, if the TEAM_HUMAN entering TEAM_ZOMBIE base every 1sec.
its a simple function.. but not work..

here is the code..

pawn Код:
forward HG();
public HG()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInRangeOfPoint(i, 7, Map[ZombieSpawnX], Map[ZombieSpawnY], Map[ZombieSpawnZ]))
            {
                if(GetPlayerTeam(i) == TEAM_ZOMBIE) return 0;
                else
                {
                    new Float:hp[MAX_PLAYERS];
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid, hp - 10);
                    GameTextForPlayer(i,"~W~Be careful you are in\n~r~Zombie Spawn Area!! -10hp", 1000, 5);
                }
            }
        }
    }
    return 1;
}
and..

pawn Код:
SetTimer("HG",1000,1); // in OnGameModeInit

===============
And here is the enum,
pawn Код:
enum mapinfo
{
    MapName[128],
    FSMapName[128],
    Float:HumanSpawnX,
    Float:HumanSpawnY,
    Float:HumanSpawnZ,
    Float:HumanSpawn2X,
    Float:HumanSpawn2Y,
    Float:HumanSpawn2Z,
    Float:ZombieSpawnX,
    Float:ZombieSpawnY,
    Float:ZombieSpawnZ,
    Float:GateX,
    Float:GateY,
    Float:GateZ,
    Float:GaterX,
    Float:GaterY,
    Float:GaterZ,
    Float:CPx,
    Float:CPy,
    Float:CPz,
    GateID,
    MoveGate,
    AllowWater,
    Interior,
    Weather,
    Time,
    EvacType,
    IsStarted,
    XPType,
};

---------------------------------

when i compiled the script it gave me this
Quote:

\gamemodes\zGM.pwn(979) : error 017: undefined symbol "playerid"
\gamemodes\zGM.pwn(980) : error 017: undefined symbol "playerid"

Help would be greatly appreciated!
Reply
#2

pawn Код:
forward HG();
public HG()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInRangeOfPoint(i, 7, Map[ZombieSpawnX], Map[ZombieSpawnY], Map[ZombieSpawnZ]))
            {
                if(GetPlayerTeam(i) == TEAM_ZOMBIE) return 0;
                else
                {
                    new Float:hp[MAX_PLAYERS];
                    GetPlayerHealth(i,hp);
                    SetPlayerHealth(i, hp - 10);
                    GameTextForPlayer(i,"~W~Be careful you are in\n~r~Zombie Spawn Area!! -10hp", 1000, 5);
                }
            }
        }
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Aliassassin123456
Посмотреть сообщение
pawn Код:
forward HG();
public HG()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInRangeOfPoint(i, 7, Map[ZombieSpawnX], Map[ZombieSpawnY], Map[ZombieSpawnZ]))
            {
                if(GetPlayerTeam(i) == TEAM_ZOMBIE) return 0;
                else
                {
                    new Float:hp[MAX_PLAYERS];
                    GetPlayerHealth(i,hp);
                    SetPlayerHealth(i, hp - 10);
                    GameTextForPlayer(i,"~W~Be careful you are in\n~r~Zombie Spawn Area!! -10hp", 1000, 5);
                }
            }
        }
    }
    return 1;
}
dear sir,
it gave me this..

Quote:

C:\Users\Guest User\Music\zGM[Fahad]\zGM[Fahad]\zGM[Fahad]\gamemodes\zGM.pwn(979) : error 035: argument type mismatch (argument 2)
C:\Users\Guest User\Music\zGM[Fahad]\zGM[Fahad]\zGM[Fahad]\gamemodes\zGM.pwn(980) : error 033: array must be indexed (variable "hp")

Reply
#4

Modifi it \n in ~n~
Reply
#5

.... sry use this:
pawn Код:
forward HG();
public HG()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInRangeOfPoint(i, 7, Map[ZombieSpawnX], Map[ZombieSpawnY], Map[ZombieSpawnZ]))
            {
                if(GetPlayerTeam(i) == TEAM_ZOMBIE) return 0;
                else
                {
                    new Float:hp;
                    GetPlayerHealth(i,hp);
                    SetPlayerHealth(i, hp - 10);
                    GameTextForPlayer(i,"~W~Be careful you are in~n~~r~Zombie Spawn Area!! -10hp", 1000, 5);
                }
            }
        }
    }
    return 1;
}
..... This forum requires that you wait 240 seconds between posts
Reply
#6

yaaay.. it work.. thx guys..

GRP sent
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)