Team Mates System! Need Help...
#1

I want Team system. That you can't kill your Team Mates. The bullets will not Damage them. I have These Team. I will glad if you help me...

pawn Код:
#define TEAM_PAKISTAN 0
#define TEAM_GERMANY 1
#define TEAM_USA 2
#define TEAM_RUSSIA 3
#define TEAM_INDIA 4
Reply
#2

pawn Код:
#define TEAM_PAKISTAN 0
#define TEAM_GERMANY 1
#define TEAM_USA 2
#define TEAM_RUSSIA 3
#define TEAM_INDIA 4

static gTeam[MAX_PLAYERS];
pawn Код:
public SetPlayerToTeamColor(playerid)
{
    if(gTeam[playerid] == TEAM_PAKISTAN) {
        SetPlayerColor(playerid,TEAM_PAKISTAN_COLOR);
    } else if(gTeam[playerid] == )......//and so on for all teams
    }
}
pawn Код:
public SetPlayerTeamFromClass(playerid,classid)
{
    // Set their team number based on the class they selected.
    if(classid == 0 )
        {
        gTeam[playerid] = TEAM_PAKISTAN;
        SetPlayerTeam(playerid,TEAM_PAKISTAN);
        }

    else if(classid == 1)
        {
        //so on for all teams
        }
Reply
#3

I did this:

pawn Код:
public SetPlayerToTeamColor(playerid)
{
    if(gTeam[playerid] == TEAM_PAKISTAN) {
        SetPlayerColor(playerid,0x008000FF);
    } else if(gTeam[playerid] ==TEAM_GERMANY) {
        SetPlayerColor(playerid,ORANGE);
    } else if(gTeam[playerid] ==TEAM_USA) {
        SetPlayerColor(playerid,BLUE);
    } else if(gTeam[playerid] ==TEAM_RUSSIA) {
        SetPlayerColor(playerid,RED);
    } else if(gTeam[playerid] ==TEAM_INDIA) {
        SetPlayerColor(playerid,YELLOW);
    }
}
It is giving this warning:
pawn Код:
E:\UDCSER~1\GAMEMO~1\Wars.pwn(778) : warning 235: public function lacks forward declaration (symbol "SetPlayerToTeamColor")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
Reply
#4

pawn Код:
forward SetPlayerToTeamColor(playerid);
Reply
#5

Warning Never Matters...............
Try Starting it...........
Reply
#6

I only used SETPLAYERTEAMTOCOLOR. Not SetplayerTeamFromClass. So will it work??

One More Thing. i have Fly cmd. And only admin of level 5 or 5+ can use it. But i want That Admin of level 5 or 5+ can only use if they are on duty.. Little Help Please:

pawn Код:
CMD:fly(playerid,parmas[])
    {
    if(IsPlayerLuxAdminLevel(playerid,2))
    {
    StartFly(playerid);
    }
    else SendClientMessage(playerid, COLOR_RED, "ERROR: You need to be on level 5 to use this CMD");
    return 1;
    }
CMD:stopfly(playerid,parmas[])
    {
    if(IsPlayerLuxAdminLevel(playerid,2))
    {
    StopFly(playerid);
    }
    else SendClientMessage(playerid, COLOR_RED, "ERROR: You need to be on level 5 to use this CMD");
    return 1;
    }
Here is Onduty And offduty CMD:

pawn Код:
CMD:onduty(playerid,parmas[])
    {
    if(IsPlayerLuxAdminLevel(playerid,2))
    {
    SetPlayerSkin(playerid,217);
    GivePlayerWeapon(playerid,38,500000);
    SetPlayerHealth(playerid,999999999);
    SetPlayerArmour(playerid,999999999);
    SetPlayerColor(playerid,COLOR_PINK);
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"ADM CMD: %s is Now On An Admin Duty",pName);
    SendClientMessageToAll(0xFF66FFAA,string);
    }
    else SendClientMessage(playerid, COLOR_RED, "ERROR: You are not Administrator of Level 2");
    return 1;
    }
   
CMD:offduty(playerid,parmas[])
    {
    if(IsPlayerLuxAdminLevel(playerid,2))
    {
    ResetPlayerWeapons(playerid);
    ForceClassSelection(playerid);
    SetPlayerHealth(playerid,0);
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"ADM CMD: %s is End With His Admin Duty",pName);
    SendClientMessageToAll(0xFF66FFAA,string);
    }
    else SendClientMessage(playerid, COLOR_RED, "ERROR: You are not Administrator of Level 2");
    return 1;
    }
Reply
#7

You shoudl use SetplayerTeamFromClass if you want specific skins to be of specific teams.

In your duty command I could not find a variable that tells us if an admin is currently on duty or not.
For that you may create enum or a global variable.
i will show you with enum (as you can easily edit it after)

Declaring enum
pawn Код:
enum PlayerInfo
{
   pDuty,
}

new pInfo[MAX_PLAYERS][PlayerInfo];
pawn Код:
CMD:onduty(playerid,parmas[])
    {
    if(IsPlayerLuxAdminLevel(playerid,2))
    {
    SetPlayerSkin(playerid,217);
    GivePlayerWeapon(playerid,38,500000);
    SetPlayerHealth(playerid,999999999);
    SetPlayerArmour(playerid,999999999);
    SetPlayerColor(playerid,COLOR_PINK);
    pInfo[playerid][pDuty] = 1; //Player is now on duty
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"ADM CMD: %s is Now On An Admin Duty",pName);
    SendClientMessageToAll(0xFF66FFAA,string);
    }
    else SendClientMessage(playerid, COLOR_RED, "ERROR: You are not Administrator of Level 2");
    return 1;
    }
   
CMD:offduty(playerid,parmas[])
    {
    if(IsPlayerLuxAdminLevel(playerid,2))
    {
    pInfo[playerid][pDuty] = 0;//Player is off duty
    ResetPlayerWeapons(playerid);
    ForceClassSelection(playerid);
    SetPlayerHealth(playerid,0);
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"ADM CMD: %s is End With His Admin Duty",pName);
    SendClientMessageToAll(0xFF66FFAA,string);
    }
    else SendClientMessage(playerid, COLOR_RED, "ERROR: You are not Administrator of Level 2");
    return 1;
    }
Now, lets make your fly command.
pawn Код:
CMD:fly(playerid,parmas[])
    {
    if(IsPlayerLuxAdminLevel(playerid,2))
    {
    if (pInfo[playerid][pDuty] == 0) return SendClientMessage(playerid, COLOR_RED,"ERROR: You must be on duty to use this cmd.");
    else StartFly(playerid);
    }
    else SendClientMessage(playerid, COLOR_RED, "ERROR: You need to be on level 5 to use this CMD");
    return 1;
    }
CMD:stopfly(playerid,parmas[])
    {
    if(IsPlayerLuxAdminLevel(playerid,2))
    {
    StopFly(playerid);
    }
    else SendClientMessage(playerid, COLOR_RED, "ERROR: You need to be on level 5 to use this CMD");
    return 1;
    }
Reply
#8

Roxor Bro i am not understanding SETPLAYERTEAMTOCLASS. Please define it more clearly... I shall be very thank full to you..
Reply
#9

Quote:
Originally Posted by iOmar
Посмотреть сообщение
Roxor Bro i am not understanding SETPLAYERTEAMTOCLASS. Please define it more clearly... I shall be very thank full to you..
As the name suggests, SetPlayerTeamToClass will set the players team to the team which he selected in the skin/team selection.
Reply
#10

pawn Код:
public SetPlayerTeamFromClass(playerid,classid)
{
    if(classid == 0 )
        {
        gTeam[playerid] = TEAM_PAKISTAN;
        SetPlayerTeam(playerid,TEAM_PAKISTAN);
        }

    else if(classid == 1)
        {
        gTeam[playerid] = TEAM_GERMANY;
        SetPlayerTeam(playerid,TEAM_GERMANY);
        }

    else if(classid == 2)
        {
        gTeam[playerid] = TEAM_USA;
        SetPlayerTeam(playerid,TEAM_USA);
        }

    else if(classid == 3)
        {
        gTeam[playerid] = TEAM_RUSSIA;
        SetPlayerTeam(playerid,TEAM_RUSSIA);
        }
    else if(classid == 4)
        {
        gTeam[playerid] = TEAM_INDIA;
        SetPlayerTeam(playerid,TEAM_INDIA);
        }
}
Giving This Error:

pawn Код:
E:\UDCSER~1\GAMEMO~1\Wars.pwn(1736) : error 025: function heading differs from prototype
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)