Need help in a team selection system
#1

Hey friends and I am here with a serious question..
I was trying to make the team selection system with defining gTeam....and all that..(sigh)
Basically at OnPlayerRequestClass I used cases to set the player's camera and the showing position but I wanted to spawn the player elsewhere(not where it was showed)
Also each team has three skins and three different spawn location and there are multiple teams(as usual)
All these factors confused me so much that I couldn't sleep that night..
Can anyone show me how to do it in an orderly manner yet fulfilling all the requirements mentioned below..

1.Each Team has 3 class(3 skins, 3 different spawn points and different show locations)
*By show locations I mean where they will be showed at OnPlayerRequestClass callback..and the show locations should be different from the spawn location.

2.There are multiple teams(as usual in every server)

3.Also, even though there are 3 spawn points all of that team should have same team color..

Would be helpful if you solved this problem...
Thanks in advance
Reply
#2

You need to read more into the functions you have in the gamemode, and server.

Even though you are using PlayerClass functions, when they OnPlayerSpawn you can still set their spawn location by simply invoking SetPlayerPos.

Same with OnPlayerRequestClass. (Which is when they are switching classes, in the Class Selection window)

PHP Code:
OnPlayerConnect // First connection
OnPlayerRequestClass // First class selection/switching classes (Add SetPlayerPos, SetPlayerInterior, SetPlayerFacingAngle, SetPlayerCameraPos SetPlayerCameralLookAt in here for your spawn screen location.)
OnPlayerRequestSpawn // Selecting to spawn
OnPlayerSpawn // Upon spawning use SetPlayerPos, SetPlayerFacingAngle, SetPlayerInterior, and SetCameraBehindPlayer 
Read into the teams system. When you set the team via the native sa-mp server it also turns FriendlyFire off with no option to reenable it.

I noticed Gammix has an include called gTeams, which could help you out.
Reply
#3

Thanks for helping..
Well I got a way to make things working...
Could you verify that this way would work or not..
Firstly I made a gteam variable and put all the teams as for example arabia1, arabia2, arabia2 and so on...so now I can also set their spawn points manually on the onplayerspawn callback....
Now time to take the values of gTeam variable and to out them all in one....just like joining pieces of puzzle..
I will create a function when arabia1, arabia2, arabia3 would come into a single team...Arabia
And now I can use gteam2 to give the value Arabia in total....and whenever I use any team commands we can then use that gteam2 to check the player's team...
Yea...my idea....full fills all the things I mentioned but is a bit messy tho....still
Would it work?
Reply
#4

It will.

A good idea is to separate the admins and the teams so any team member can be an admin,

I'm guessing that you've upgraded your IDE from pawno to notepad++ or another equivalent.
Reply
#5

Yes I did...who uses the year old pawno?
Reply
#6

Oh you'd be surprised how many forgo the advantage of code folding and tab lines.
Reply
#7

Code:
public OnGameModeInit()
{
	//team1
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	
	//team2
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    new team1skins[] = {0,1,2};
    new team2skins[] = {3,4,5};
	switch(classid)
	{
	    case 0..2:
	    {
	        SetPlayerSkin(playerid, team1skins[random(3)]);
	        SetPlayerTeam(playerid, 1);
		SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
		SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
		SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	     }
	     case 3..5:
	     {
	        SetPlayerSkin(playerid, team2skins[random(3)]);
	        SetPlayerTeam(playerid, 2);
		SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
		SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
		SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	     }
	}
	return 1;
}
I'm not sure if i got you, but i council you to use case x..y: //a.k.a classid => x && classid =< y
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)