[HELP] Check this code
#1

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    if((weaponid == 0) && (gTeam[issuerid] == 8) && (gTeam[issuerid] == 9) && (gTeam[issuerid] == 10))
{
             new Float:Health, Float:a;
             GetPlayerArmour(playerid,a);
             if(a > 0)
             {
                SetPlayerArmour(playerid, a-10);
                InfectionTime[playerid] = 0;
                SetTimer("infectiontimer", 1000, true);//starts infection
                IsInfected[playerid] = 1;
             }
             else
             {
                GetPlayerHealth(playerid,Health);
                SetPlayerHealth(playerid, Health-4);
                GetPlayerHealth(issuerid,Health);
                if(Health < 100) SetPlayerHealth(issuerid, Health+6);
                InfectionTime[playerid] = 0;
                SetTimer("infectiontimer", 1000, true);//starts infection
                IsInfected[playerid] = 1;
             }

}
    return 1;
}
I made this code , so i only be sure if it work , so Teams 8 & 9 & 10 are Zombies .
Questions:

1-As i thought , issuerid = Zombies (or player who give dammage , or punch player)
playerid=Survivors (playerid reffers to players who get dammage the punched ones).
is it Correct ?

2-This is what the script will do :
if a player is a part of Team 8 or Team 9 or Team 10 , and punch a player (weaponid 0) , the Punched Players(playerid) will lose health & armour. & start a timer for them.
are those things will happen?(i didn't spoke about armour..)
Thank you
Reply
#2

the best way to know is to try the code...
Reply
#3

This won't work

Код:
if((weaponid == 0) && (gTeam[issuerid] == 8) && (gTeam[issuerid] == 9) && (gTeam[issuerid] == 10)
Your basically checking if their gTeam variable is 8 AND 9 AND 10
Which is impossible. If you want to check if they're either of those, use the OR symbol: ||
Instead of the && symbol.
Reply
#4

hmm.. i will do it ,
@Jonny : i can not test it myself

so:
issuerid = the player who punch(give dammage)
playerid= the player who receive dammage
is it right ?
Reply
#5

HEY GUYS CAN I GET REP BACK i rep Both of you please be kind and do the same
Reply
#6

Quote:
Originally Posted by Saw®
Посмотреть сообщение
hmm.. i will do it ,
@Jonny : i can not test it myself

so:
issuerid = the player who punch(give dammage)
playerid= the player who receive dammage
is it right ?
Yes that is correct
Reply
#7

it will be like that : ?
pawn Код:
if((weaponid == 0) || (gTeam[issuerid] == 8) || (gTeam[issuerid] == 9) || (gTeam[issuerid] == 10)
i don't think that puting OR symbole instead of && between Weaponid & gTeam 8 will have an effect... but for other i think it's ok..
Reply
#8

Quote:
Originally Posted by Saw®
Посмотреть сообщение
it will be like that : ?
pawn Код:
if((weaponid == 0) || (gTeam[issuerid] == 8) || (gTeam[issuerid] == 9) || (gTeam[issuerid] == 10)
i don't think that puting OR symbole instead of && between Weaponid & gTeam 8 will have an effect... but for other i think it's ok..
It will, because before that you were just checking if gTeam[issuerid] == 8 AND it = 9, AND 10, which was impossible, so I think you should add ((weaponid) == 0) &&
So it checks if they have weapon 0 AND theyre any of the following 3 teams.
Reply
#9

guys can i get rep please? :')
Reply
#10

Quote:
Originally Posted by DeathTone
Посмотреть сообщение
It will, because before that you were just checking if gTeam[issuerid] == 8 AND it = 9, AND 10, which was impossible, so I think you should add ((weaponid) == 0) &&
So it checks if they have weapon 0 AND theyre any of the following 3 teams.
oh you've right ! thank u ++Rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)