SetPlayerTeam not preventing damage
#7

Considering the code you have provided, you seam to set all players teams with "playersTeam[playerid]" when they spawn without actually setting the variables value first(Unless you have not shown us yet) which i think will be recognised as 0 and then your call a 1 second timer over and over and set that same variable to +20(Which then would be 20)

So what i have established from this thread, is you have somehow confused yourself with a variable(Or do not fully understand how a variable works yet)

This is how i would create a team system.


pawn Код:
#include <a_samp>

//STEP 1: First we must define our teams(tell pawno what our teams are going to be called)
#define TEAM_ONE 0//Team 1 will now be recognised as TEAM_ONE or simply 0
#define TEAM_TWO 1//Team 2 will now be recognised as TEAM_TWO or simply 1
//We also need to create a player variable to use to check/set playerid's team/s
new GetTeam[MAX_PLAYERS];

//STEP 2: We now add AddPlayerClass functions for each of our skins, we will use 2 skins today, 1 per team.
public OnGameModeInit()
{
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);//Team 1 skin (Line 1)
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);//Team 2 skin (Line 2)
    return 1;
}

//STEP 3: Now we need to create a system so the player can choose a skin before spawning, while we check
//what skin they are looking at and set the team id to the AddPlayerClass lines.
public OnPlayerRequestClass(playerid, classid)
{
    switch(classid)//The classid parameter is the line count of the AddPlayerClass function/s under OnGameModeInit
    {
        case 0://Line 1 (Team 1 skin)
        {
            GameTextForPlayer(playerid, "Team One", 5000, 5);//Let the player know what team(skin) there looking at
            GetTeam[playerid] = TEAM_ONE;//Set there player variable to the team id
        }
        case 1://Line 2 (Team 2 skin)
        {
            GameTextForPlayer(playerid, "Team Two", 5000, 5);//Let the player know what team(skin) there looking at
            GetTeam[playerid] = TEAM_TWO;//Set there player variable to the team id
        }
    }
    return 1;
}

//LAST STEP: In this step i will show you how you can use your new class system.
public OnPlayerSpawn(playerid)
{
    if(GetTeam[playerid] == TEAM_ONE)
    {
        //Set Team 1 spawn locations/weapons/colors etc.
    }
    else if(GetTeam[playerid] == TEAM_TWO)
    {
        //Set Team 2 spawn locations/weapons/colors etc.
    }
    return 1;
}
//The player will continue to spawn in there selected team/skin until they are forced to selection, via command or
//relogging to go back to there first spawn.

//The rest is straight forward and if you wish to send players back to class selection(without relogging again)
//Simply use: ForceClassSelection(playerid);





//Blasphemy
Reply


Messages In This Thread
SetPlayerTeam not preventing damage - by SuperViper - 19.09.2012, 23:14
Re: SetPlayerTeam not preventing damage - by Mauzen - 19.09.2012, 23:26
Re: SetPlayerTeam not preventing damage - by SuperViper - 19.09.2012, 23:27
Re: SetPlayerTeam not preventing damage - by ThePhenix - 19.09.2012, 23:28
Re: SetPlayerTeam not preventing damage - by ThePhenix - 19.09.2012, 23:40
Re: SetPlayerTeam not preventing damage - by SuperViper - 19.09.2012, 23:41
Re: SetPlayerTeam not preventing damage - by Blasphemy - 20.09.2012, 01:20
Re: SetPlayerTeam not preventing damage - by SuperViper - 20.09.2012, 01:40
Re: SetPlayerTeam not preventing damage - by Blasphemy - 20.09.2012, 01:53
Re: SetPlayerTeam not preventing damage - by SuperViper - 20.09.2012, 01:57

Forum Jump:


Users browsing this thread: 1 Guest(s)