Team and Skin problem
#1

Hello. I am trying to make a team system based on what skin you select at the respawn. But the problem is it doesn't detect few skins.

Example:
Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(GetPlayerSkin(playerid) == 280)
    	{
		pTeam[playerid] = team_lspd;
		GivePlayerWeapon(playerid, 24, 90);
        GivePlayerWeapon(playerid, 31, 1000);
		SetPlayerColor(playerid, COLOR_DBLUE);
		}
    if(GetPlayerSkin(playerid) == 287)
    	{
		pTeam[playerid] = team_sasf;
		GivePlayerWeapon(playerid, 24, 90);
        GivePlayerWeapon(playerid, 31, 1000);
		SetPlayerColor(playerid, COLOR_GREEN);
		}
	else
		{
 		pTeam[playerid] = team_civ;
 		GivePlayerWeapon(playerid, 24, 90);
 		SetPlayerColor(playerid, COLOR_WHITE);
		}
	return 1;
}
I did define the teams and pTeam. If I choose the Soldier skin (287) I become team_sasf, but if I choose cop skin (280) i get team_civ.

Yes i did AddPlayerClass both the skins.
Can someone please help me?
Reply
#2

public OnPlayerRequestClass(playerid, classid)

to

public OnPlayerSpawn(playerid)
Reply
#3

Quote:
Originally Posted by aRoach
Посмотреть сообщение
public OnPlayerRequestClass(playerid, classid)

to

public OnPlayerSpawn(playerid)
Tried, same result
Reply
#4

Try this not sure if it will work...

Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(GetPlayerSkin(playerid) == 280)
    	{
		pTeam[playerid] = team_lspd;
		GivePlayerWeapon(playerid, 24, 90);
        GivePlayerWeapon(playerid, 31, 1000);
		SetPlayerColor(playerid, COLOR_DBLUE);
		}
    else if(GetPlayerSkin(playerid) == 287)
    	{
		pTeam[playerid] = team_sasf;
		GivePlayerWeapon(playerid, 24, 90);
        GivePlayerWeapon(playerid, 31, 1000);
		SetPlayerColor(playerid, COLOR_GREEN);
		}
	else if(!(GetPlayerSkin(playerid) == 287 && GetPlayerSkin(playerid) == 280))
		{
 		pTeam[playerid] = team_civ;
 		GivePlayerWeapon(playerid, 24, 90);
 		SetPlayerColor(playerid, COLOR_WHITE);
		}
	return 1;
}
Reply
#5

pawn Код:
public OnPlayerSpawn(playerid)
{
    pTeam[playerid] = team_civ;
    GivePlayerWeapon(playerid, 24, 90);
    SetPlayerColor(playerid, COLOR_WHITE);

    switch(GetPlayerSkin(playerid))
    {
        case 280:
        {
            pTeam[playerid] = team_lspd;
            GivePlayerWeapon(playerid, 24, 90);
            GivePlayerWeapon(playerid, 31, 1000);
            SetPlayerColor(playerid, COLOR_DBLUE);
        }
        case 287:
        {
            pTeam[playerid] = team_sasf;
            GivePlayerWeapon(playerid, 24, 90);
            GivePlayerWeapon(playerid, 31, 1000);
            SetPlayerColor(playerid, COLOR_GREEN);
        }
    }
    return 1;
}
Reply
#6

Quote:
Originally Posted by aRoach
Посмотреть сообщение
pawn Код:
public OnPlayerSpawn(playerid)
{
    pTeam[playerid] = team_civ;
    GivePlayerWeapon(playerid, 24, 90);
    SetPlayerColor(playerid, COLOR_WHITE);

    switch(GetPlayerSkin(playerid))
    {
        case 280:
        {
            pTeam[playerid] = team_lspd;
            GivePlayerWeapon(playerid, 24, 90);
            GivePlayerWeapon(playerid, 31, 1000);
            SetPlayerColor(playerid, COLOR_DBLUE);
        }
        case 287:
        {
            pTeam[playerid] = team_sasf;
            GivePlayerWeapon(playerid, 24, 90);
            GivePlayerWeapon(playerid, 31, 1000);
            SetPlayerColor(playerid, COLOR_GREEN);
        }
    }
    return 1;
}
Couldent you use default: instead of the code you used above the switch statement?
Reply
#7

Quote:
Originally Posted by aRoach
Посмотреть сообщение
pawn Код:
public OnPlayerSpawn(playerid)
{
    pTeam[playerid] = team_civ;
    GivePlayerWeapon(playerid, 24, 90);
    SetPlayerColor(playerid, COLOR_WHITE);

    switch(GetPlayerSkin(playerid))
    {
        case 280:
        {
            pTeam[playerid] = team_lspd;
            GivePlayerWeapon(playerid, 24, 90);
            GivePlayerWeapon(playerid, 31, 1000);
            SetPlayerColor(playerid, COLOR_DBLUE);
        }
        case 287:
        {
            pTeam[playerid] = team_sasf;
            GivePlayerWeapon(playerid, 24, 90);
            GivePlayerWeapon(playerid, 31, 1000);
            SetPlayerColor(playerid, COLOR_GREEN);
        }
    }
    return 1;
}
It didn't work sorry Thanks for replying!!

Quote:
Originally Posted by Jason_Thunde
Посмотреть сообщение
Try this not sure if it will work...

Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(GetPlayerSkin(playerid) == 280)
    	{
		pTeam[playerid] = team_lspd;
		GivePlayerWeapon(playerid, 24, 90);
        GivePlayerWeapon(playerid, 31, 1000);
		SetPlayerColor(playerid, COLOR_DBLUE);
		}
    else if(GetPlayerSkin(playerid) == 287)
    	{
		pTeam[playerid] = team_sasf;
		GivePlayerWeapon(playerid, 24, 90);
        GivePlayerWeapon(playerid, 31, 1000);
		SetPlayerColor(playerid, COLOR_GREEN);
		}
	else if(!(GetPlayerSkin(playerid) == 287 && GetPlayerSkin(playerid) == 280))
		{
 		pTeam[playerid] = team_civ;
 		GivePlayerWeapon(playerid, 24, 90);
 		SetPlayerColor(playerid, COLOR_WHITE);
		}
	return 1;
}
It worked AS A CHARM! thanks! Just that I said
Код:
        else
		{
 		pTeam[playerid] = team_civ;
 		GivePlayerWeapon(playerid, 24, 90);
 		SetPlayerColor(playerid, COLOR_WHITE);
		}
Reply
#8

Np I just added else if instead and Made a check if there skin isent 280 or 287 it would define them else it would add then to the other groups
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)