OnPlayerTakeDammage -
DeathMatchEnFrancais - 06.11.2014
Hello I'm working on a system so that when you pull a player of his team nothing happens how do I get errors
Код HTML:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
new Float:HP;
GetPlayerHealth(playerid, HP);
if(TEAM_AT[playerid] == 1 && TEAM_AT[playerid] == 1)
{
SetPlayerHealth(playerid, HP-0);
}
if(TEAM_TERRO[playerid] == 2 && TEAM_TERRO[playerid] == 2)
{
SetPlayerHealth(playerid, HP-0);
}
return 1;
}
Код HTML:
C:\Users\JAIED\Desktop\z\gamemodes\s.pwn(2015) : error 029: invalid expression, assumed zero
C:\Users\JAIED\Desktop\z\gamemodes\s.pwn(2015) : error 029: invalid expression, assumed zero
C:\Users\JAIED\Desktop\z\gamemodes\s.pwn(2015) : warning 215: expression has no effect
C:\Users\JAIED\Desktop\z\gamemodes\s.pwn(2015) : error 001: expected token: ";", but found "]"
C:\Users\JAIED\Desktop\z\gamemodes\s.pwn(2015) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Re: OnPlayerTakeDammage -
CNMike - 06.11.2014
It seems like an issue with your defines, which line is 2015?
your define should look like this...
Код:
new TEAM_AT[MAX_PLAYERS];
new TEAM_TERRO[MAX_PLAYERS];
Also it makes no sense, why you have this twice...
Код:
if(TEAM_TERRO[playerid] == 2 && TEAM_TERRO[playerid] == 2)
Re: OnPlayerTakeDammage -
DeathMatchEnFrancais - 06.11.2014
2015 is online if(TEAM_AT[playerid] == 1 && TEAM_AT[playerid] == 1)
#define TEAM_AT 1
#define TEAM_TERRO 2
The deflines
Re: OnPlayerTakeDammage -
CNMike - 06.11.2014
Since TEAM_AT is a define and not a variable it can't have [playerid] next to it, because it is not an array. However, if you keep the defines without the player id...all your if statement would be saying is 1==1 which is common sense. I'd love to help, but I need you to go into more detail on what you are trying to do.
Re: OnPlayerTakeDammage -
DeathMatchEnFrancais - 06.11.2014
if(TEAM_AT == 1 && TEAM_AT == 1)
C:\Users\JAIED\Desktop\Counter Strike samp 0.3z\gamemodes\css.pwn(2015) : warning 206: redundant test: constant expression is non-zero
1 erreurs
Re: OnPlayerTakeDammage -
M4D - 06.11.2014
as CNMike said TEAM_AT isn't variable...
try this (
*if this defines are your teams):
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
new Float:HP;
GetPlayerHealth(playerid, HP);
if(GetPlayerTeam(playerid) == 1)
{
SetPlayerHealth(playerid, HP-0);
}
if(GetPlayerTeam(playerid) == 2)
{
SetPlayerHealth(playerid, HP-0);
}
return 1;
}
Re: OnPlayerTakeDammage -
CNMike - 06.11.2014
All that is doing is saying that 1==1. The purpose of an if statement is to check when a variable is at a certain number. Since define TEAM_AT 1, will always be 1 then your code is exactly like this...
Re: OnPlayerTakeDammage -
DeathMatchEnFrancais - 06.11.2014
No error thank you! but his walk when I pull on my team loses no life?
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
new Float:HP;
GetPlayerHealth(playerid, HP);
if(GetPlayerTeam(playerid) == 1)
{
SetPlayerHealth(playerid, HP-0);
}
if(GetPlayerTeam(playerid) == 2)
{
SetPlayerHealth(playerid, HP-0);
}
return 1;
}
Re: OnPlayerTakeDammage -
CNMike - 06.11.2014
Okay the first thing you need to do is realize if teams are defined by a variable that is in your script, or if its defined by sa-mp functions, because GetPlayerTeam(playerid) only works if you used SetPlayerTeam(playerid), somewhere in your script. So do a search in your script for "SetPlayerTeam", and then if you find something confirm that you are using the right team numbers.