SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 23/01/2010, 01:14 AM   #1
AlbanianGuy
Huge Clucker
 
Join Date: Oct 2009
Posts: 211
Reputation: 0
Default how to make a soldier aotumaticly be general when the general dies ?

can anyone help me with this ?
AlbanianGuy is offline   Reply With Quote
Old 23/01/2010, 01:46 AM   #2
Torran
High-roller
 
Join Date: Jan 2010
Posts: 1,794
Reputation: 1
Default Re: how to make a soldier aotumaticly be general when the general dies ?

Pick a random id?
Then on that ids death?
Get it to choose a diffrent one?
Im not sure quite what your wanting here
Torran is offline   Reply With Quote
Old 23/01/2010, 01:48 AM   #3
AlbanianGuy
Huge Clucker
 
Join Date: Oct 2009
Posts: 211
Reputation: 0
Default Re: how to make a soldier aotumaticly be general when the general dies ?

Quote:
Originally Posted by Torran
Pick a random id?
Then on that ids death?
Get it to choose a diffrent one?
Im not sure quite what your wanting here
look its like , , a president and a vice president . when the president dies the vice president has to be president , so how to do it ?
AlbanianGuy is offline   Reply With Quote
Old 23/01/2010, 05:18 AM   #4
mansonh
Gangsta
 
Join Date: Jun 2009
Posts: 619
Reputation: 0
Default Re: how to make a soldier aotumaticly be general when the general dies ?

Untested but i think this is what you are looking for.

Code was updated see: http://forum.sa-mp.com/index.php?top...7586#msg887586
Code:

__________________
mansonh is offline   Reply With Quote
Old 23/01/2010, 07:21 AM   #5
AlbanianGuy
Huge Clucker
 
Join Date: Oct 2009
Posts: 211
Reputation: 0
Default Re: how to make a soldier aotumaticly be general when the general dies ?

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 ?
AlbanianGuy is offline   Reply With Quote
Old 23/01/2010, 07:55 AM   #6
KnooL
Huge Clucker
 
Join Date: Jan 2009
Posts: 442
Reputation: 0
Default Re: how to make a soldier aotumaticly be general when the general dies ?

What do you use to save the players team and ranks?
__________________
217.18.70.94:7777
http://mafiacityrpg.com
Quote:
Originally Posted by bajskorv123 View Post
Will returning 0 at OnPlayerDisconnect work?
Just a quick question because im too lazy to test.
Would be nice if you could keep players on server xD
KnooL is offline   Reply With Quote
Old 23/01/2010, 09:00 AM   #7
mansonh
Gangsta
 
Join Date: Jun 2009
Posts: 619
Reputation: 0
Default Re: how to make a soldier aotumaticly be general when the general dies ?

Quote:
Originally Posted by KnooL
What do you use to save the players team and ranks?
Yah we need to know more about how your code is setup to help you.
__________________
mansonh is offline   Reply With Quote
Old 23/01/2010, 09:15 PM   #8
AlbanianGuy
Huge Clucker
 
Join Date: Oct 2009
Posts: 211
Reputation: 0
Default Re: how to make a soldier aotumaticly be general when the general dies ?

guys look i got a commander , then the if the commander dies , the general with the most points , the most kills , automaticly becomes commander , , do you knopw what i mean ?
AlbanianGuy is offline   Reply With Quote
Old 23/01/2010, 11:05 PM   #9
mansonh
Gangsta
 
Join Date: Jun 2009
Posts: 619
Reputation: 0
Default Re: how to make a soldier aotumaticly be general when the general dies ?

Yes, and the code i gave you should work, just make a loop to find the soldier with the highest score.

I don't know exactly how your team system works, but you should be able to modify my code to fit.

Other than showing us your team system we can't do much more.
__________________
mansonh is offline   Reply With Quote
Old 23/01/2010, 11:46 PM   #10
AlbanianGuy
Huge Clucker
 
Join Date: Oct 2009
Posts: 211
Reputation: 0
Default Re: how to make a soldier aotumaticly be general when the general dies ?

hey but how to find the highest score of the player and when the general dies the soldier becomes general , ok i know hte code for it , how about the loop or what erver you said , how to find it . peace
out
and thanks
AlbanianGuy is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
General Reference Mike Scripting Help 311 17/05/2014 02:39 PM
Help general [ZX]_Whitewolf Help Archive 0 15/06/2010 11:04 PM
From soldier to go to general ... when a certain score reached .. how ? AlbanianGuy Help Archive 17 21/02/2010 01:13 AM
Scripting in general ilikepie2221 Help Archive 5 25/09/2009 10:17 PM
General Help with an RP server. Marclang Help Archive 5 13/06/2009 06:37 PM


All times are GMT. The time now is 10:29 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.