SA-MP Forums Archive
AddPlayerClassEx problems... - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: AddPlayerClassEx problems... (/showthread.php?tid=158513)



AddPlayerClassEx problems... - Ash. - 10.07.2010

Hi there all
Im having problems, with the following section of my gamemode, it compiles, however...

It sets all data up in the OnPlayerRequestClass section, it sets the interiors, positions, facing angle (everything) in there perfectly. But it only allows me to select CJ (who as you can see below, isnt even in the list) and wont allow me to spawn a player. I dont know whats up with it

The code below is my "problem" area.
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerInterior(playerid,14);
    SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
    SetPlayerFacingAngle(playerid, 270.0);
    SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
    SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
}

public OnGameModeInit()
{
    // Lets turn off a few things first :)
    EnableStuntBonusForAll(0);

    SetGameModeText("Trucking World v1.0");

    //TEMPLATE: AddPlayerClassEx(teamid, modelid, spawn_x, spawn_y, spawn_z, z_angle, 0, 0, 0, 0, 0, 0);
    // Player Class ID 1 == Truckers
    AddPlayerClassEx(1, 128, -783.7039872943303, 705.7229784321546, 18.0, 269.15, 0, 0, 0, 0, 0, 0);
    AddPlayerClassEx(1, 131, -783.7039872943303, 705.7229784321546, 18.0, 269.15, 0, 0, 0, 0, 0, 0);
    AddPlayerClassEx(1, 132, -783.7039872943303, 705.7229784321546, 18.0, 269.15, 0, 0, 0, 0, 0, 0);
    AddPlayerClassEx(1, 133, -783.7039872943303, 705.7229784321546, 18.0, 269.15, 0, 0, 0, 0, 0, 0);
    AddPlayerClassEx(1, 161, -783.7039872943303, 705.7229784321546, 18.0, 269.15, 0, 0, 0, 0, 0, 0);
    AddPlayerClassEx(1, 162, -783.7039872943303, 705.7229784321546, 18.0, 269.15, 0, 0, 0, 0, 0, 0);
    AddPlayerClassEx(1, 201, -783.7039872943303, 705.7229784321546, 18.0, 269.15, 0, 0, 0, 0, 0, 0);
    AddPlayerClassEx(1, 202, -783.7039872943303, 705.7229784321546, 18.0, 269.15, 0, 0, 0, 0, 0, 0);
    // Player Class ID 2 == Assistance
    // ID 50
    // Player Class ID 3 == Police
   
    // Player Class ID 4 == Unemployed
   
    // End Classes
    return 0;
}
Thanks in advance
Ash!


Re: AddPlayerClassEx problems... - Ash. - 10.07.2010

*Sorry for the bump, but ive just thought of something...

Should i put AddPlayerClassEx in the PlayerRequestClass section instead?


Re: AddPlayerClassEx problems... - ViruZZzZ_ChiLLL - 10.07.2010

Just do this :
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
 SetPlayerInterior(playerid,14);
 SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
 SetPlayerFacingAngle(playerid, 270.0);
 SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
 SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);

 if(classid == 0)
 {
  ...
 }
 if(classid == 1)
 {
  ...
 }
 ......
 return 1;
}
You get the point.
Also, don't forget to SetPlayerInterior(playerid, 0) on player spawn :P


Re: AddPlayerClassEx problems... - Ash. - 10.07.2010

I have to do that for all those?


Re: AddPlayerClassEx problems... - ViruZZzZ_ChiLLL - 10.07.2010

Quote:
Originally Posted by funky1234
Посмотреть сообщение
I have to do that for all those?
Yeah, you have 8 classes to be exact.
Don't forget to start with
pawn Код:
if(classid == 0)
{
}
Then end with :
pawn Код:
if(classid == 7)
{
}



Re: AddPlayerClassEx problems... - Ash. - 10.07.2010

I do intend to add more, so i would just carry on the pattern?
And what goes in
pawn Код:
if(classid == NUMBER)
{
  HERE??
}



Re: AddPlayerClassEx problems... - ViruZZzZ_ChiLLL - 10.07.2010

Yes It just depends on how many classes
you have on OnGameModeInit()


Re: AddPlayerClassEx problems... - Ash. - 10.07.2010

Quote:
Originally Posted by funky1234
Посмотреть сообщение
I do intend to add more, so i would just carry on the pattern?
And what goes in
pawn Код:
if(classid == NUMBER)
{
  HERE??
}
Does my "SetPlayerPos" go in there? So when someone presses "Spawn" it exectues this:
pawn Код:
if(classid == NUMBER)
{
  SetPlayerPos(x, y, z etc)
}



Re: AddPlayerClassEx problems... - ViruZZzZ_ChiLLL - 10.07.2010

No, it will go OnPlayerSpawn if you want to have random spawns

or just change the coords of the x, y, z of your
pawn Код:
AddPlayerClassEx(teamid, skin, Float:x, Float:y, Float:z, Float:Angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo)



Re: AddPlayerClassEx problems... - Ash. - 10.07.2010

So what does go in there? Nothing??