/dm not team killing system - LAST DM THREAD
#1

Hey hey hey yeah i make all this is last request about DM
i spam to much about dm, this is the end of about DM Thread
Can someone give me code about team killing heres my team code

TOP OF SCRIPT:

pawn Код:
#define TEAM_XS_MAFIA 0
#define TEAM_XS_Killers 1
/dm1 with Show Dialog Choose Skin:

pawn Код:
if(strcmp("/dm1", cmdtext, true, 10) == 0)
    {
        if(InSpawn[playerid] == true) return SendClientMessage(playerid, COLOR_RED, "You can't use this command while on class selection");
        if(GetPVarInt(playerid, "InDm") == 1) return SendClientMessage(playerid,COLOR_RED, "You are already in DM Area");
        SetPVarInt(playerid, "skin", GetPlayerSkin(playerid));
        SetPVarInt(playerid, "InDm", 1);
        SetPlayerVirtualWorld(playerid, 1);
        new pName[MAX_PLAYER_NAME];
        new string[128];
        GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
        format(string, sizeof(string), "{FFFFFF}[SERVER]:{FF002B}%s has teleported to {FFFFFF}Deathmatch Area 1 - DM Area 1 (/dm1)",pName);
        SendClientMessageToAll(COLOR_RED, string);
        SendClientMessage(playerid, COLOR_GREEN,"Welcome To DM Area");
        GameTextForPlayer(playerid,"~w~Welcome To ~r~Death ~g~Match ~y~Area 1",3000,3);
        SetPlayerPos(playerid,1050.6841,938.1620,18.5841);
        SetPlayerFacingAngle(playerid,143);
        ShowPlayerDialog(playerid,9,DIALOG_STYLE_LIST,"Choose Your Team!","Team Xtreme Stunting Mafia\nTeam Xtreme Stunting Killers","Choose","Exit");
        return 1;
    }
The OnDialogResponse Code:

pawn Код:
if(dialogid == 9)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    SendClientMessage(playerid,COLOR_GREEN, "You have choosen the Team XS-MAFIA");
                    SetPlayerTeam(playerid,0);
                    SetPlayerSkin(playerid,124);
                    SetPlayerPos(playerid, 1026.6808,933.3270,12.2681);
                    SetPlayerFacingAngle(playerid, 90.6338);
                    GivePlayerWeapon(playerid, 30, 9999);
                    GivePlayerWeapon(playerid, 5, 1);
                    GivePlayerWeapon(playerid, 22, 9999);
                    GivePlayerWeapon(playerid, 29, 9999);
                    GivePlayerWeapon(playerid, 27, 9999);
                    SetPlayerColor(playerid,COLOR_BLUE);
                }
                case 1:
                {
                    SendClientMessage(playerid, COLOR_GREEN, "You have choosen the Team XS-Killer");
                    SetPlayerTeam(playerid,1);
                    SetPlayerSkin(playerid,165);
                    SetPlayerPos(playerid, 1026.7742,904.0728,14.0098);
                    SetPlayerFacingAngle(playerid, 273.0681);
                    GivePlayerWeapon(playerid, 30, 9999);
                    GivePlayerWeapon(playerid, 8, 1);
                    GivePlayerWeapon(playerid, 22, 9999);
                    GivePlayerWeapon(playerid, 27, 9999);
                    GivePlayerWeapon(playerid, 29, 9999);
                    GivePlayerWeapon(playerid, 31, 9999);
                    SetPlayerColor(playerid,COLOR_RED);
                }
            }
        }
        else if(!response) return SendClientMessage(playerid,COLOR_RED, "You have to choose a team to spawn!") && ShowPlayerDialog(playerid,8,DIALOG_STYLE_LIST,"Choose Your Team!","Team Xtreme Stunting Mafia\nTeam Xtreme Stunting Killers","Choose","Exit");
    }
I hope you help me
Reply
#2

PHP код:
new killerteam,playerteam;
killerteam GetPlayerTeam(killerid);
playerteam GetPlayerTeam(playerid);
if(
playerteam == killerteam)
{
//if its Team killing
}
else
{
//if its not

Reply
#3

Where should i put this ?
Reply
#4

PHP код:
public OnPlayerDeath 
if you want it to be only for DM add DM Variable
Reply
#5

Aah that's hard code.

Best easy and working code is here:

On top

pawn Код:
new gTeam[MAX_PLAYERS]; //Hope you already have this.
Underneath

pawn Код:
forward SettingPlayerTeam(); //Teamkill
OnGameModeInit

pawn Код:
SetTimer("SettingPlayerTeam", 5000 ,true); //Teamkill
And anywhere this in your FS/GM.

pawn Код:
public SettingPlayerTeam()
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            SetPlayerTeam(i, gTeam[i]);
        }
    }
}
This code works great if you will put in Corrent places.

Thanks
Reply
#6

what it does do?

Davz?
Reply
#7

It is team protection code.

You can't hit team.
Reply
#8

WOW this is better than dimi's code

thx dude so if i hit my team member he cant get any hurt - shot from me/or others?
Reply
#9

Dude its team protection code, You cant kill your team, If you even shoot your team no lose health.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)