SA-MP Forums Archive
Weird problem. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Weird problem. (/showthread.php?tid=557904)



Weird problem. - Glossy42O - 15.01.2015

Hello,

I have a little weird problem, i used class selection maker it always works but now it's the same, maybe it's the codes problem.

I see only the sea

PHP код:
public OnPlayerRequestClass(playerid,classid)
{
  if(
GetPlayerSkin(playerid))
  {
    if(
GetPlayerTeam(playerid) == TEAM_BALLAS)
    {
         
SetPlayerPos(playerid1980.3785, -1197.684527.2536);
         
SetPlayerInterior(playerid0);
         
SetPlayerFacingAngle(playerid87.6159);
         
SetPlayerCameraPos(playerid1976.8785, -1193.684528.7536);
         
SetPlayerCameraLookAt(playerid1980.3785, -1197.684527.2536);
         return 
1;
    }
    if(
GetPlayerTeam(playerid) == TEAM_CHINESE)
    {
         
SetPlayerPos(playerid1171.9240, -1442.254045.3524);
         
SetPlayerInterior(playerid0);
         
SetPlayerFacingAngle(playerid87.4755);
         
SetPlayerCameraPos(playerid1168.4240, -1438.254046.8524);
         
SetPlayerCameraLookAt(playerid1171.9240, -1442.254045.3524);
         return 
1;
    }
    if(
GetPlayerTeam(playerid) == TEAM_COPS)
    {
         
SetPlayerPos(playerid1540.3800, -1627.462113.3828);
         
SetPlayerInterior(playerid0);
         
SetPlayerFacingAngle(playerid91.3813);
         
SetPlayerCameraPos(playerid1536.8800, -1623.462114.8828);
         
SetPlayerCameraLookAt(playerid1540.3800, -1627.462113.3828);
         return 
1;
    }
    if(
GetPlayerTeam(playerid) == TEAM_GROVE)
    {
         
SetPlayerPos(playerid2494.4997, -1686.371013.5131);
         
SetPlayerInterior(playerid0);
         
SetPlayerFacingAngle(playerid0.6305);
         
SetPlayerCameraPos(playerid2490.9997, -1682.371015.0131);
         
SetPlayerCameraLookAt(playerid2494.4997, -1686.371013.5131);
         return 
1;
    }
    if(
GetPlayerTeam(playerid) == TEAM_HOBOS)
    {
         
SetPlayerPos(playerid1117.9002, -2036.907378.7500);
         
SetPlayerInterior(playerid0);
         
SetPlayerFacingAngle(playerid89.8325);
         
SetPlayerCameraPos(playerid1114.4002, -2032.907380.2500);
         
SetPlayerCameraLookAt(playerid1117.9002, -2036.907378.7500);
         return 
1;
    }
    if(
GetPlayerTeam(playerid) == TEAM_VAGOS)
    {
         
SetPlayerPos(playerid2575.4946, -1042.160169.5781);
         
SetPlayerInterior(playerid0);
         
SetPlayerFacingAngle(playerid353.5356);
         
SetPlayerCameraPos(playerid2571.9946, -1038.160171.0781);
         
SetPlayerCameraLookAt(playerid2575.4946, -1042.160169.5781);
         return 
1;
    }
  }
    return 
1;




Re: Weird problem. - mahdi499 - 15.01.2015

Can i ask how did you define the skins? Since this will only check the player's skin and doesnt actually assign them to the team unless you predefined it somewhere else.


Re: Weird problem. - Glossy42O - 15.01.2015

That's how
PHP код:
    AddPlayerClass(230,1118.2677,-2048.4426,74.4297,264.7455,0,0,0,0,0,0); //
    
AddPlayerClass(137,1119.9713,-2024.5944,74.4297,270.6989,0,0,0,0,0,0); //
    
AddPlayerClass(136,1191.3344,-2028.5454,69.0078,267.8789,0,0,0,0,0,0); //
    
AddPlayerClass(79,1201.1931,-2054.2395,75.4605,268.8187,0,0,0,0,0,0); //Hobos 
And so on..


Re: Weird problem. - mahdi499 - 15.01.2015

I believe that wont work for the reason, that the skin numbers dont hold team information. What i can suggest is a Stock.

pawn Код:
Stock GetTeamSkin(playerid)
{
    new team;
    new skin = GetPlayerSkin(playerid);
    if(skin == 280) //This is an Example
    {
        team = 2;
    }
    else if......
    {
   
    }
    return team;
}
After that you can use it in this way:
pawn Код:
public OnPlayerRequestClass(playerid,classid)
{
    if(GetTeamSkin(playerid) == 1) // Team Ballas For Example
    {
        // Do this and this
    }
    else if(GetTeamSkin(playerid) == 2)
    {
        // Do That
    }
}
I didnt test the code but you get the point.


Re: Weird problem. - Glossy42O - 15.01.2015

didn't work.


Re: Weird problem. - Clad - 15.01.2015

You should define the teams and use gTeam


Re: Weird problem. - Glossy42O - 15.01.2015

I did define the teams, and i HAVE to use gteam ?


Re: Weird problem. - Glossy42O - 16.01.2015

bump


Re: Weird problem. - Glossy42O - 18.01.2015

bump


Re: Weird problem. - Glossy42O - 19.01.2015

bump