SA-MP Forums Archive
Will this work? (Anti team kill) (rep++) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Will this work? (Anti team kill) (rep++) (/showthread.php?tid=340147)



Will this work? (Anti team kill) (rep++) - iOmar - 06.05.2012

I did this for Anti-Team Killing. So will this work?? I only want that player of same team can not hurt each other.... So will this work. if not then plzz tell me how??

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerTeam(playerid, TEAM_PAKISTAN);
    SetPlayerTeam(playerid, TEAM_GERMANY);
    SetPlayerTeam(playerid, TEAM_USA);
    SetPlayerTeam(playerid, TEAM_RUSSIA);
    SetPlayerTeam(playerid, TEAM_INDIA);



Re: Will this work? (Anti team kill) (rep++) - DeathTone - 06.05.2012

nope wont work

you can only set one team at once, when you set another team right after another, it will override the last team.


Re: Will this work? (Anti team kill) (rep++) - iOmar - 06.05.2012

So how can it work?? Please Help me..


Respuesta: Will this work? (Anti team kill) (rep++) - Chris1337 - 06.05.2012

why you dont make players select His/her class ? will be easier


Re: Will this work? (Anti team kill) (rep++) - Ballu Miaa - 06.05.2012

Are'nt you stealing my script ROFL [I almost have same teams in my new GM]? I guess you're from India as noone will ever add India And Pakistan in teams.

You have gTeams[MAX_PLAYERS]; Declared in your game mode? Then use this.
pawn Код:
forward SetTeamToPlayer(playerid);
public SetTeamToPlayer(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(gTeam[playerid] == TEAM_INDIA) { SetPlayerTeam(playerid, TEAM_INDIA); }
        else if(gTeam[playerid] == TEAM_GERMANY) { SetPlayerTeam(playerid, TEAM_GERMANY); }
        else if(gTeam[playerid] == TEAM_USA) { SetPlayerTeam(playerid, TEAM_USA); }
        else if(gTeam[playerid] == TEAM_RUSSIA) { SetPlayerTeam(playerid, TEAM_RUSSIA); }
        else if(gTeam[playerid] == TEAM_PAKISTAN) { SetPlayerTeam(playerid, TEAM_PAKISTAN); }
    }
    return 1;
}

//Add this line under OnPlayerSpawn(playerid)
SetTeamToPlayer(playerid);



Re: Will this work? (Anti team kill) (rep++) - iOmar - 06.05.2012

It is compiling perfect. I'll check it out later. Thnks for help. (Reped all)


Re: Will this work? (Anti team kill) (rep++) - Ballu Miaa - 06.05.2012

Quote:
Originally Posted by iOmar
Посмотреть сообщение
It is compiling perfect. I'll check it out later. Thnks for help. (Reped all)
Cool. Btw you're from India right? XD Goodluck with your CW Script.