09.09.2011, 20:56
This is for scripters that got Problems with SetPlayerTeamFromClass
Don't fret, it is not the end of the world, this is just saying you never used it. This will go away in part 2.
If your making a simple team death match then you wont need a lot of this tutorial, but this part is important for later.
Above the main function, you will need to define the teams.
But before we start all of the setting player team, we need to create variables to tell the script how to check teams. It's a simple variable above the main function.
If you compile now you will get an error
now on OnPlayerRequestClass we do this : You delete the SetPlayerPos , SetPlayerCameraPos and SetPlayerCameraLookAt then you add this:
Then we will add the Teams/Gangs under OnPlayerRequestClass!
Under OnGameModeInit we will add some skins and the coordinates are the Spawn of your Team/Gang
Hope this will help!
if you find mistakes post em!
Don't fret, it is not the end of the world, this is just saying you never used it. This will go away in part 2.
If your making a simple team death match then you wont need a lot of this tutorial, but this part is important for later.
Above the main function, you will need to define the teams.
pawn Code:
#define BALLAS 0 // we define the Teams now = Ballas
#define GROVES 1 // Same = Groves
pawn Code:
new gTeam[MAX_PLAYERS];
If you compile now you will get an error
pawn Code:
warning 203: symbol is never used: "gTeam"
now on OnPlayerRequestClass we do this : You delete the SetPlayerPos , SetPlayerCameraPos and SetPlayerCameraLookAt then you add this:
pawn Code:
forward SetPlayerTeamFromClass(playerid, classid);
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerTeamFromClass(playerid, classid);
return 1;
}
public SetPlayerTeamFromClass(playerid, classid)
{
pawn Code:
if(classid == 0)
{
gTeam[playerid] = BALLAS;
GameTextForPlayer(playerid,"~w~Ballas",3000,5); // This will show up an Text , when you select your class
SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779); // position of the player in the class selection
SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909); // Cameraposition
SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
SetPlayerFacingAngle(playerid,122.4500);
SetPlayerColor(playerid,0xA000FFFF); // Teamcolor
}
else if(classid == 1)
{
gTeam[playerid] = GROVES;
GameTextForPlayer(playerid,"~w~Grove Street Famlilys",3000,5);
SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
SetPlayerFacingAngle(playerid,252.4717);
SetPlayerColor(playerid,0x55FF00FF);
}
}
pawn Code:
// Ballas
AddPlayerClass(104,1979.1917,-1222.0964,25.1824,97.3597,0,0,0,0,0,0); // 104=Skin , 1979.1917 =X ect....
// Groves
AddPlayerClass(107,2508.5671,-1673.6665,13.3793,86.2585,0,0,0,0,0,0);
Hope this will help!
if you find mistakes post em!