[HELP] Check this code -
Saw® - 20.06.2012
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
Re: [HELP] Check this code -
Jonny5 - 21.06.2012
the best way to know is to try the code...
Re: [HELP] Check this code -
DeathTone - 21.06.2012
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.
Re: [HELP] Check this code -
Saw® - 21.06.2012
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 ?
Re: [HELP] Check this code -
Geeboi_Mehdi - 21.06.2012
HEY GUYS CAN I GET REP BACK i rep Both of you please be kind and do the same
Re: [HELP] Check this code -
DeathTone - 21.06.2012
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
Re: [HELP] Check this code -
Saw® - 21.06.2012
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..
Re: [HELP] Check this code -
DeathTone - 21.06.2012
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.
Re: [HELP] Check this code -
Geeboi_Mehdi - 21.06.2012
guys can i get rep please? :')
Re: [HELP] Check this code -
Saw® - 21.06.2012
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