[FilterScript] Elections System
#1

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.
Reply
#2

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
Reply
#3

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


EDIT: fixed, thank you.
Reply
#4

Nice, Can u make in dialog form?
Reply
#5

you gave me an idea! thank you
Reply
#6

cool idea rly
Reply
#7

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.
Reply
#8

Good work
Reply
#9

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

Looks good :P
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)