You can only choose 1 team?
#1

Hey, I am making a TDM server, and well, you can only choose the team Grove, if you pick Ballas, then you spawn at Grove with Grove skin and weapons. And if you hit Grove, you spawn at Grove still.

So I am unable to pick Ballas.

Код:
public OnPlayerSpawn(playerid)
{
    if(gTeam[playerid] == BALLAS)
    {
        SetPlayerSkin(playerid, 104);
        SetPlayerPos(playerid, 2419.1653,-1232.5118,24.4743);
    }
    if(gTeam[playerid] = GROVES)
    {
        SetPlayerSkin(playerid, 107);
        SetPlayerPos(playerid, 2500.6060,-1672.1453,13.3512);
    }
        SendClientMessage(playerid, -1, "You can use /wpack to purches weapons, it costs $10,000");
    GivePlayerWeapon(playerid, 30, 600);
    return 1;
}
}
Reply
#2

nvm lol
Reply
#3

pawn Код:
if(gTeam[playerid] == GROVES)
Surely that should have given you a Syntax error? Being = and not ==?

Anyhow, show us your team selection code, as this isn't the problem/
Reply
#4

Wrongly way to make a team selection in this way..
pawn Код:
// at ongamemodeinit, put your AddPlayerClass codes which are 2 under this function:
public OnGameModeInit()
{
       AddPlayerClass(...) // first one in the script, so it's ID automatically becomes '0', Let's set it the GROVE one.
       AddPlayerClass(...) // second one in the script, so it's ID automatically becomes '1' , Let's set it the BALLAS one.
       return 1;
}
Spawn stuff are done, now let's use OnPlayerRequestClass:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
       switch(classid) // switching the class..
       {
               case 0: // if the class id was 0 (GROVE one)
               {
                       gTeam[playerid] = GROVE;
                       // weapons, skin, etc are not needed here though, be cause they're already added in addplayerclass code you have put
               }
               case 1: // if the class was 1 (BALLAS one)
               {
                        gTeam[playerid] = BALLAS;
                        // same as grove, you don't need to set weapons cuz u already set them in addplayerclass
               }
       }
       return 1;
}
// We are done.
Код:
AddPlayerClass(skin, Float:x, Float:y, Float:z, Float:Angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo)
Do whatever you want on spawn now if you want to check his team and send a message that he's in this team as an example, be cause his team already set.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)