Team Kill Help +Rep
#1

Hey, how do i make this team no attack the humans? BTW, here is the script

pawn Код:
if(gTeam[playerid] == SOLDIER)
    {
        SendClientMessage(playerid, SOLDIER_COLOR, "You are a soldier, try to kill the special zombies to get 10+ scores! Try to do /cmds for info and cmds.");
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 100);
        SetPlayerTeam(playerid, HUMAN);
        SetPlayerTeam(playerid, SOLDIER);
    }
Reply
#2

Reply back if this doesn't work, I haven't tested it out. What the code is doing is checking the teams of both the person shooting and the person who was shot. If the shooter is a soldier shooting a human, it gives the human his health back and returns an error to the soldier.
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    if(gTeam[issuerid] == SOLDIER && gTeam[playerid] == HUMAN) SetPlayerHealth(playerid,+amount) && SendClientMessage(issuerid,color,"You cannot shoot humans, aim for the zombies!");
}
Reply
#3

When i compile, i got this:
Код:
C:\Users\Zhen\Desktop\Games\GTA - San Andreas\SAMP Server\gamemodes\Noobflies11.PWN(763) : error 029: invalid expression, assumed zero
C:\Users\Zhen\Desktop\Games\GTA - San Andreas\SAMP Server\gamemodes\Noobflies11.PWN(763) : warning 215: expression has no effect
C:\Users\Zhen\Desktop\Games\GTA - San Andreas\SAMP Server\gamemodes\Noobflies11.PWN(763) : error 001: expected token: ";", but found ")"
C:\Users\Zhen\Desktop\Games\GTA - San Andreas\SAMP Server\gamemodes\Noobflies11.PWN(763) : error 029: invalid expression, assumed zero
C:\Users\Zhen\Desktop\Games\GTA - San Andreas\SAMP Server\gamemodes\Noobflies11.PWN(763) : fatal error 107: too many error messages on one line
Reply
#4

i recommend you use this function, it's basically an anti team kill.

https://sampwiki.blast.hk/wiki/SetPlayerTeam
Reply
#5

Quote:
Originally Posted by YourLord
Посмотреть сообщение
i recommend you use this function, it's basically an anti team kill.

https://sampwiki.blast.hk/wiki/SetPlayerTeam
He is using this function, and an anti team killing function isn't what he's looking for if you'd read his post thoroughly. I'm getting a fix up, Deaglez, just a sec.

Edit: Try this out.
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    if(GetPlayerTeam(issuerid) == SOLDIER && GetPlayerTeam(playerid) == HUMAN) {
        new Float:health = GetPlayerHealth(playerid,health);
        SetPlayerHealth(playerid,health+amount);
        SendClientMessage(issuerid,COLOUR_RED,"You cannot shoot humans, aim for the zombies!"); }
}
Reply
#6

Um the compile works fine, but when im ingame i spawn as SOLDIER then shoot at the humans, it took a lot of damage like the player only have 10 hp
Reply
#7

BTW, the humans can shoot the SOLDIER team too
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)