SA-MP Forums Archive
PTP Vice President function! - 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: PTP Vice President function! (/showthread.php?tid=248648)



PTP Vice President function! - Admigo - 15.04.2011

Heey players

I make a ptp server. I want to make that if the president dies that the vicepresident changes to the president!
I cant figure it out:S

Pls help

thank Admigo


Re: PTP Vice President function! - Kyle - 15.04.2011

E.G

if(gTeam[playerid] == TEAM_PRESIDENT)
{
gTeam[playerid] = TEAM_NONE;
gTeam[GetViceID()] = TEAM_PRESIDENT;

}


Re: PTP Vice President function! - Admigo - 15.04.2011

How can i get vice id? I use PTPM Gamemode script


Re: PTP Vice President function! - Kyle - 15.04.2011

Make a stock so it runs though a loop and check if the team of that player is vice president, if it is stop the loop and return the playerid.


Re: PTP Vice President function! - Admigo - 15.04.2011

Can you give code because i am beginner. I dont know anything about loops:S


Re: PTP Vice President function! - Cameltoe - 15.04.2011

Quote:
Originally Posted by admigo
Посмотреть сообщение
Can you give code because i am beginner. I dont know anything about loops:S
This isn't the request section.

pawn Код:
stock GetViceID()
{
     new ID = -1;
     for(new i; i < MAX_PLAYERS; i++) //Foreach (Y)
     {
          if(IsPlayerConnected(i) && IsVice[i]) ID = i; break;
     }
     if(ID != -1) return ID;
     else printf("No vice id found.");
}



Re: PTP Vice President function! - Admigo - 15.04.2011

And how to get the vice id with skin 147. I use gTeam


Re: PTP Vice President function! - Cameltoe - 15.04.2011

Quote:
Originally Posted by admigo
Посмотреть сообщение
And how to get the vice id with skin 147. I use gTeam
Change "IsVice[i]" to whatever variable the Vice is stored in.

perhaps
pawn Код:
gTeam[i] == TEAM_VICE



Re: PTP Vice President function! - Admigo - 15.04.2011

And how can i make the vice function?


Re: PTP Vice President function! - Cameltoe - 15.04.2011

Quote:
Originally Posted by admigo
Посмотреть сообщение
And how can i make the vice function?
You're pretty good to explain