SA-MP Forums Archive
[FilterScript] Elections System - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Elections System (/showthread.php?tid=476444)



Elections System - iPrivate - 18.11.2013

Heyo!

This is my first filterscript after 2 gamemode releases. In this release I though to make something special, or at least something that I've not seen before. SORRY IF THERE IS ONE KIND OF THIS ALREADY.

It's really easy and has to do with ONLY 4 commands. I tried to make them to look as RP as more but I didn't use Proxydetector in this script. I'll use it in the next version.

Features
• Everyone can vote for someone (Only 2 persons for now)
• Roleplay system and messages that will be sent to everyone in the server when someone votes.
• RCON ability to check the votes of each player. ONLY RCON USERS can do that.
• Fast command processing using zCMD. May further change it to Y_Ini but I ain't sure when I will.

Screenshots





Download
pawn Код:
#include <a_samp>
#include <zcmd>

// Defines for the elenctions.

new VotesFirstguy[MAX_PLAYERS];
new VotesSecondguy[MAX_PLAYERS];

// The script part

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("Goverment Elenctions for Roleplay server");
    print("--------------------------------------\n");
    return 1;
}

COMMAND:votefirstguy(playerid, params[])
{
    new string[128];
    new name[MAX_PLAYER_NAME+4];
   
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "{FF0080} %s gets a pen and starts writing something on a letter found nearby.", name);
    SendClientMessageToAll(0xFFFFFFFF, string);
    format(string, sizeof(string), "{FF0080} %s grabs the letter and puts it inside a box.", name);
    SendClientMessageToAll(0xFFFFFFFF, string);
   
    VotesFirstguy[playerid]++;
    return 1;
}

COMMAND:votesecondguy(playerid, params[])
{
    new string[128];
    new name[MAX_PLAYER_NAME+4];

    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "{FF0080} %s gets a pen and starts writing something on a letter found nearby.", name);
    SendClientMessageToAll(0xFFFFFFFF, string);
    format(string, sizeof(string), "{FF0080} %s grabs the letter and puts it inside a box.", name);
    SendClientMessageToAll(0xFFFFFFFF, string);

    VotesSecondguy[playerid]++;
    return 1;
}

COMMAND:firstguyvotes(playerid, params[])
{
    new string[128];
    if(!IsPlayerAdmin(playerid))    return SendClientMessage(playerid, 0xFFFFFFFF, "You must be an admin to check the elenction votes");
    format(string, sizeof(string), "{FF0080} The firstguy has %d number of votes.", VotesFirstguy[playerid]);
    SendClientMessage(playerid, 0xFFFFFFFF, string);
    return 1;
}

COMMAND:secondguyvotes(playerid, params[])
{
    new string[128];
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You must be an admin to check the elenction votes");
    format(string, sizeof(string), "{FF0080} The secondguy has %d number of votes.", VotesSecondguy[playerid]);
    SendClientMessage(playerid, 0xFFFFFFFF, string);
    return 1;
}
NOTE: Change the command names to whatever you like or whoever is going to be part of the elections. I'll make a tutorial soon on how to add more voted people or functions.

Thank you.


Re: Elections System - Patrick - 18.11.2013

Really basic, but I've spot some mistakes in the code

pawn Код:
COMMAND:votefirstguy(playerid, params[])
//and
COMMAND:votesecondguy(playerid, params[])
Those codes above needs to be returned true;/1, or else it will give you an error in-game but the command will still work


Re: Elections System - iPrivate - 18.11.2013

I just saw that it was missing.. What a dumb..


EDIT: fixed, thank you.


Re: Elections System - hhaaoo123 - 18.11.2013

Nice, Can u make in dialog form?


Re: Elections System - Naruto_Emilio - 18.11.2013

you gave me an idea! thank you


Re: Elections System - ***Niko*** - 18.11.2013

cool idea rly


Re: Elections System - iPrivate - 19.11.2013

Quote:
Originally Posted by Naruto_Emilio
Посмотреть сообщение
you gave me an idea! thank you
Really going to use that idea; OMG -_-

Quote:
Originally Posted by ***Niko***
Посмотреть сообщение
cool idea rly
Thank you bro. Yea, an election system for voting people is useful in roleplay servers sometime.


Re: Elections System - ReD_DeVi - 20.11.2013

Good work


Re: Elections System - iPrivate - 01.12.2013

Quote:
Originally Posted by ReD_DeVi
Посмотреть сообщение
Good work
Thank you,


Re: Elections System - Gen3i - 01.12.2013

Looks good :P