how to make a soldier aotumaticly be general when the general dies ?
#5

Quote:
Originally Posted by mansonh
Untested but i think this is what you are looking for.

Code:
new President= -1;

public OnPlayerSpawn(playerid)
{
   if(President==-1)
   {
     President=playerid;
   }
}
public OnPlayerDisconnect(playerid, reason)
{
  if(playerid == President)
   {
     SelectNewPresident(playerid, "disconnected");
   }
}
public OnPlayerDeath(playerid, killerid, reason)
{
   if(playerid == President)
   {
     SelectNewPresident(playerid, "died");
   }
}
stock SelectNewPresident(PreviousPres, reason[])
{
   new playerid;
   while(President==PreviousPres)
   {
     playerid = Random(MAX_PLAYERS-1);
     if(IsPlayerConnected(playerid))
     {
        President==playerid;
     }
   }
   new msg[128], new prevName[24], newName[24];
   GetPlayerName(PreviousPres, prevName, sizeof(prevName));
   GetPlayerName(President, newName, sizeof(newName));
   format(msg, sizeof(msg), "President %s has %s, %s has become President", prevName, reason, newName);
   SendClientMessageToAll(0xDEEE20FF, msg);
}
but i need it fo general and soldier , so i only change teh name of the teams , , right ? and where do i put this ?
Reply


Messages In This Thread
how to make a soldier aotumaticly be general when the general dies ? - by AlbanianGuy - 23.01.2010, 00:14
Re: how to make a soldier aotumaticly be general when the general dies ? - by Torran - 23.01.2010, 00:46
Re: how to make a soldier aotumaticly be general when the general dies ? - by AlbanianGuy - 23.01.2010, 00:48
Re: how to make a soldier aotumaticly be general when the general dies ? - by mansonh - 23.01.2010, 04:18
Re: how to make a soldier aotumaticly be general when the general dies ? - by AlbanianGuy - 23.01.2010, 06:21
Re: how to make a soldier aotumaticly be general when the general dies ? - by KnooL - 23.01.2010, 06:55
Re: how to make a soldier aotumaticly be general when the general dies ? - by mansonh - 23.01.2010, 08:00
Re: how to make a soldier aotumaticly be general when the general dies ? - by AlbanianGuy - 23.01.2010, 20:15
Re: how to make a soldier aotumaticly be general when the general dies ? - by mansonh - 23.01.2010, 22:05
Re: how to make a soldier aotumaticly be general when the general dies ? - by AlbanianGuy - 23.01.2010, 22:46
Re: how to make a soldier aotumaticly be general when the general dies ? - by mansonh - 24.01.2010, 12:33
Re: how to make a soldier aotumaticly be general when the general dies ? - by mansonh - 24.01.2010, 21:34
Re: how to make a soldier aotumaticly be general when the general dies ? - by AlbanianGuy - 24.01.2010, 23:57
Re: how to make a soldier aotumaticly be general when the general dies ? - by mansonh - 25.01.2010, 22:23
Re: how to make a soldier aotumaticly be general when the general dies ? - by AlbanianGuy - 25.01.2010, 22:25
Re: how to make a soldier aotumaticly be general when the general dies ? - by mansonh - 25.01.2010, 22:52
Re: how to make a soldier aotumaticly be general when the general dies ? - by AlbanianGuy - 26.01.2010, 02:41
Re: how to make a soldier aotumaticly be general when the general dies ? - by mansonh - 26.01.2010, 03:27
Re: how to make a soldier aotumaticly be general when the general dies ? - by AlbanianGuy - 26.01.2010, 03:39
Re: how to make a soldier aotumaticly be general when the general dies ? - by mansonh - 26.01.2010, 04:31
Re: how to make a soldier aotumaticly be general when the general dies ? - by AlbanianGuy - 26.01.2010, 04:32
Re: how to make a soldier aotumaticly be general when the general dies ? - by mansonh - 26.01.2010, 07:24
Re: how to make a soldier aotumaticly be general when the general dies ? - by AlbanianGuy - 26.01.2010, 18:37
Re: how to make a soldier aotumaticly be general when the general dies ? - by mansonh - 26.01.2010, 20:55
Re: how to make a soldier aotumaticly be general when the general dies ? - by AlbanianGuy - 26.01.2010, 22:28
Re: how to make a soldier aotumaticly be general when the general dies ? - by mansonh - 26.01.2010, 23:09
Re: how to make a soldier aotumaticly be general when the general dies ? - by AlbanianGuy - 26.01.2010, 23:12
Re: how to make a soldier aotumaticly be general when the general dies ? - by mansonh - 27.01.2010, 05:40
Re: how to make a soldier aotumaticly be general when the general dies ? - by AlbanianGuy - 27.01.2010, 06:07
Re: how to make a soldier aotumaticly be general when the general dies ? - by Kinetic - 27.01.2010, 06:24
Re: how to make a soldier aotumaticly be general when the general dies ? - by AlbanianGuy - 27.01.2010, 06:54
Re: how to make a soldier aotumaticly be general when the general dies ? - by mansonh - 27.01.2010, 07:49
Re: how to make a soldier aotumaticly be general when the general dies ? - by AlbanianGuy - 27.01.2010, 08:04
Re: how to make a soldier aotumaticly be general when the general dies ? - by mansonh - 27.01.2010, 08:14
Re: how to make a soldier aotumaticly be general when the general dies ? - by AlbanianGuy - 29.01.2010, 02:22
Re: how to make a soldier aotumaticly be general when the general dies ? - by Jonny5 - 13.05.2012, 15:35

Forum Jump:


Users browsing this thread: 2 Guest(s)