PDA

View Full Version : Team and Skin problem


MadalinX5
10/10/2011, 03:26 PM
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? :)

aRoach
10/10/2011, 03:42 PM
public OnPlayerRequestClass(playerid, classid)

to

public OnPlayerSpawn(playerid)

MadalinX5
10/10/2011, 03:45 PM
public OnPlayerRequestClass(playerid, classid)

to

public OnPlayerSpawn(playerid)

Tried, same result :(

Jason_Thunde
10/10/2011, 03:47 PM
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;
}

aRoach
10/10/2011, 03:51 PM
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;
}

Jason_Thunde
10/10/2011, 03:52 PM
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?

MadalinX5
10/10/2011, 04:02 PM
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!! :)

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);
}

Jason_Thunde
10/10/2011, 04:09 PM
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