Need Help with Zombie Infecting commands(Will give Rep for Help)
#1

Hey guys this just my 2nd week in scripting i havent learned much.. to be honest i have small prob u see im trying to
make a script for the zombies to infect Human players.... well theres a twist..
You see i have 5 teams of humans and 5 teams of zombies
each team is different from one another...
for eg:Humans - Civil,Sheriff,Cops,swat,Fbi,Army ; Zombies- zombies,runner,smoker,Hunter,witch,Xmutant

Here are the defines i did
Код:
#define CIVIL   0
#define SHERIFF 1
#define POLICE  2
#define SWAT    3
#define FBI     4
#define ARMY    5
#define ZOMBIE  6
#define RUNNER  7
#define SMOKER  8
#define HUNTER  9
#define WITCH   10
#define XMUTANT 11
For each teams i added more than 1 skin so i used "AddPlayerClassEx" in ''OnGameModeInit()''

now i made class selection menu and team colours and all that..

So guys heres the tricky part i cant under stand how to give the zombie teams the abiity to infect the human Teams and i mean only the Human teams.... And Not the other zombies like runners or smokers... or hunter,witch ,xmutant cause you know there different teams :P even though they should work together

heres a code i got from " [FBI]M.Vulture[XAC] " all credits to infecting codes goes for him.
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_FIRE)
    {
        for(new i=0;i<MAX_PLAYERS;i++)
        {
            new Float:X, Float:Y, Float:Z;
            GetPlayerPos(i, X, Y, Z);
            if(gTeam[playerid]==6||7||8||9||10||11)
            {
                if(IsPlayerInRangeOfPoint(playerid, 1.0, X, Y, Z))
                {
                    if(gTeam[i]!=6|!=7||!=8||!=9||!=10||!=11)
                    {
                        new Float:H;
                        GetPlayerHealth(i, H);
                        SetPlayerHealth(i, H-10);
                        SetPVarInt(playerid, "Infected",0||1||2||3||4||5);
                        if(GetPVarInt(playerid,"Infected") == 6)
                        {
                            GameTextForPlayer(i, "~r~Your Infected Its Over !!!", 500, 3);
                        }

                    }
                }
            }
        }
    }
    return 1;
}
when i compile
Код:
Zombie.pwn(1450) : error 029: invalid expression, assumed zero
Zombie.pwn(1450) : error 029: invalid expression, assumed zero
Zombie.pwn(1450) : error 029: invalid expression, assumed zero
Zombie.pwn(1450) : fatal error 107: too many error messages on one line
4 Errors.
The infecting codes starts from line 1438 and ends at 1467

Can some one pls briefly explain what are functions the stuff done this code and help with this topic.... please help this is major footstep to completing my game mod... if theres a way to make it even better and effective pls share the idea ..Thanks in advance.
Reply
#2

plss write here a line 1450
Reply
#3

I've never used PlayerVars but I think this should work:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_FIRE)
    {
        for(new i=0;i<MAX_PLAYERS;i++)
        {
            new Float:X, Float:Y, Float:Z;
            GetPlayerPos(i, X, Y, Z);
            if(gTeam[i] == 6 || gTeam[i] == 7 || gTeam[i] == 8 || gTeam[i] == 9 || gTeam[i] == 10 || gTeam[i] == 11)
            {
                if(IsPlayerInRangeOfPoint(playerid, 1.0, X, Y, Z))
                {
                    if(gTeam[i] != 6 || gTeam[i] != 7 || gTeam[i] != 8 || gTeam[i] != 9 || gTeam[i] != 10 || gTeam[i] != 11)
                    {
                        new Float:H;
                        GetPlayerHealth(i, H);
                        SetPlayerHealth(i, H-10);
                        SetPVarInt(playerid, "Infected",GetPVarInt(playerid,"Infected"))+1
                        if(GetPVarInt(playerid,"Infected") == 6)
                        {
                            GameTextForPlayer(i, "~r~Your Infected Its Over !!!", 500, 3);
                        }

                    }
                }
            }
        }
    }
    return 1;
}
Reply
#4

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_FIRE)
    {
        for(new i=0;i<MAX_PLAYERS;i++)
        {
            new Float:X, Float:Y, Float:Z;
            GetPlayerPos(i, X, Y, Z);
            if(gTeam[i] == 6 || gTeam[i] == 7 || gTeam[i] == 8 || gTeam[i] == 9 || gTeam[i] == 10 || gTeam[i] == 11)
            {
                if(IsPlayerInRangeOfPoint(playerid, 1.0, X, Y, Z))
                {
                    if(gTeam[i] != 6 || gTeam[i] != 7 || gTeam[i] != 8 || gTeam[i] != 9 || gTeam[i] != 10 || gTeam[i] != 11)
                    {
                        new Float:H;
                        GetPlayerHealth(i, H);
                        SetPlayerHealth(i, H-10);
                        SetPVarInt(playerid, "Infected",GetPVarInt(playerid,"Infected")+1);
                        if(GetPVarInt(playerid,"Infected") == 6)
                        {
                            GameTextForPlayer(i, "~r~Your Infected Its Over !!!", 500, 3);
                        }

                    }
                }
            }
        }
    }
    return 1;
}
just a little fix on Tee code..
Reply
#5

Yea thanks, I missed that.
*facepalm*

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_FIRE)
    {
        for(new i=0;i<MAX_PLAYERS;i++)
        {
            new Float:X, Float:Y, Float:Z;
            GetPlayerPos(i, X, Y, Z);
            if(gTeam[i] == 6 || gTeam[i] == 7 || gTeam[i] == 8 || gTeam[i] == 9 || gTeam[i] == 10 || gTeam[i] == 11)
            {
                if(IsPlayerInRangeOfPoint(playerid, 1.0, X, Y, Z))
                {
                    if(gTeam[i] != 6 || gTeam[i] != 7 || gTeam[i] != 8 || gTeam[i] != 9 || gTeam[i] != 10 || gTeam[i] != 11)
                    {
                        new Float:H;
                        GetPlayerHealth(i, H);
                        SetPlayerHealth(i, H-10);
                        SetPVarInt(playerid, "Infected",GetPVarInt(playerid,"Infected")+1);
                        if(GetPVarInt(playerid,"Infected") == 6)
                        {
                            GameTextForPlayer(i, "~r~Your Infected Its Over !!!", 500, 3);
                        }

                    }
                }
            }
        }
    }
    return 1;
}
Reply
#6

Thank you i will test it ...and as promissed.. rep is given
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)