Jump to content
Sign in to follow this  
silly_ghillie

How to script in a president slot

Recommended Posts

So I want to script a president onto this map where I play with my friends. The president is voted in, they get TP'd to a house. And when they connect after disconnecting it will spawn them there. And someone can get voted in and the old pres will be removed from office and replaced.

I also want the president to change laws or taxes etc. like island life.

Thanks

Edited by Silly_Ghillie

Share this post


Link to post
Share on other sites

You're asking for a lot here. Do you have a money system set up? A voting system? A job system? Recurring payments? A tax system? Shops?

I'm really tired right now, but I wrote some code that might help you. It should all work okay.

isPresident = player0; //not sure how null works in arma 3 so this is a throwaway value
almostPres = player0;
highestVotes = 0;
voteArray = [ARRAY WITH ALL PLAYERS]; //you'll probably need this to keep track of votes
voteNumbers = [0]; //
voteTie = [];

//not sure how you're going to handle the voting part, maybe a GUI box that players can click on to vote for their friends?

{
   if (voteArray select (_x - 1)) > highestVotes then
       {
           call compile format ["almostPres = player%1;", _x];
       };
} forEach voteArray;

//{
//    if ((voteArray select (_x - 1)) = highestVotes) then
//        {
//            voteTie set [_x, = 
// This code was supposed to check for ties and then order a re-vote but I'm too tired to think

isPresident = almostPres; //"officially" makes the president the president

isPresident setPos [houseXCoord, houseYCoord, houseZCoord]; //teleports president to his house

and if someone could tell me how to make the PHP Code that would be nice, I just use "code" and "/code" and my code doesn't have cool colors

Good Luck

Edited by DreadedEntity

Share this post


Link to post
Share on other sites
if someone could tell me how to make the php code that would be nice

Here you go:

[<slash>php]. Be warned that the board's PHP formatting can break your code depending on the EOL characters used - so if you copy paste from poseidon then I'd stick with regular code tags.
Edited by SilentSpike

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×