20.08.2011, 12:01
(
Last edited by knackworst; 20/08/2011 at 12:46 PM.
)
Hi everyone,
You may have searched in this forum for an anti teamkill system...
as you can notice, there are not so many anti teamkill systems, and nor are there any anti-teamkill system that really makes the shooter NOT BEING ABLE to kill the target.
So I wanted to make this little tutorial : )
So how does it work?
Well, when a player shoots a player from its own team, then the shooter will die and get a message that teamkilling is not allowed. however, the target will regain the damage he lost by a teamkill-attempt, so that the victim of teamkilling doesn't have to die immediately...
Note: u are only going to be able to use this script, if u already worked with teams in your GM/Filterscript, otherwise U are going to get errors...
So, how are we going to do this?
STEP 1
First of all we will need a little include, made by wups, and it can be downloaded here:
http://forum.sa-mp.com/showthread.ph...highlight=OPSP
To install, u have to click the version u want, then copy the pastebin material, paste in notepad and save as OPSP.inc
then move it to the folder: pawno/include
and just paste it there...
next u wanna add
at the top of your GM, or the script u wanna make our little anti-teamkill thing in.
Paste it under
Ok, then add this somewhere in your Script:
STEP 2
now we are going to start to script.
so we have
now add this under the first { bracket:
So, we will get this:
Just compile the script, save it and u don't have problems with teamkilling in your server anymore!
enjoy your Teamkilling-free server
Bye
You may have searched in this forum for an anti teamkill system...
as you can notice, there are not so many anti teamkill systems, and nor are there any anti-teamkill system that really makes the shooter NOT BEING ABLE to kill the target.
So I wanted to make this little tutorial : )
So how does it work?
Well, when a player shoots a player from its own team, then the shooter will die and get a message that teamkilling is not allowed. however, the target will regain the damage he lost by a teamkill-attempt, so that the victim of teamkilling doesn't have to die immediately...
Note: u are only going to be able to use this script, if u already worked with teams in your GM/Filterscript, otherwise U are going to get errors...
So, how are we going to do this?
STEP 1
First of all we will need a little include, made by wups, and it can be downloaded here:
http://forum.sa-mp.com/showthread.ph...highlight=OPSP
To install, u have to click the version u want, then copy the pastebin material, paste in notepad and save as OPSP.inc
then move it to the folder: pawno/include
and just paste it there...
next u wanna add
PHP Code:
#include <OPSP>
Paste it under
PHP Code:
#include <a_samp>
PHP Code:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
return 1;
}
now we are going to start to script.
so we have
PHP Code:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
return 1;
}
PHP Code:
if ( Shooter != INVALID_PLAYER_ID )
{
if ( GetPlayerTeam( Target ) == GetPlayerTeam( Shooter ) ) // check if the victim is from the same team as the shooter.
{
new Float:hp;
GetPlayerHealth(Target, hp);
SetPlayerHealth(Target, hp + HealthLost);
SetPlayerHealth( Shooter, 0 );
SendClientMessage( Shooter, COLOR_RED, "Team killing is not allowed!" );
GivePlayerMoney( Shooter, - 5000 );
}
}
PHP Code:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
if ( Shooter != INVALID_PLAYER_ID )
{
if ( GetPlayerTeam( Target ) == GetPlayerTeam( Shooter ) ) // check if the victim is from the same team as the shooter.
{
new Float:hp;
GetPlayerHealth(Target, hp);
SetPlayerHealth(Target, hp + HealthLost);
SetPlayerHealth( Shooter, 0 );
SendClientMessage( Shooter, COLOR_RED, "Team killing is not allowed!" );
GivePlayerMoney( Shooter, - 5000 );
}
}
return 1;
}
enjoy your Teamkilling-free server
Bye