Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ================================================================================
- Phanto's Script
- ________________________________________________________________________________
- •Skripta: PVoteKick •Skripter: Phanto90
- •Tip: FS •Velicina datoteke: 6 Kb
- •Linije: 261 •Verzija: 1.0v
- ________________________________________________________________________________
- * Opis *
- Ovo je jednostavna filterskripta.To je sistem za glasanje da se nekoga kicka
- (izbaci) sa servera.
- ________________________________________________________________________________
- */
- //===============INCLUDE
- #include <a_samp>
- //===============COLORI
- #define COLOR_ERROR 0xCB544EFF
- #define COLOR_OK 0x50C94EFF
- //===============0.3c
- #define RED "{C14124}"
- #define GREY "{BBBBBB}"
- #define GREEN "{60B149}"
- #define none "{B35349}"
- //===============DIALOG
- #define DIALOG_VOTEKICK 1945
- //===============VAR
- new nput2[128];
- new razlog[128];
- new rdialog;
- new bool:IsVoteKickStarted,
- bool:HasPlayerVoted[MAX_PLAYERS];
- new PlayerToKick=-1,
- Yes,No,
- seconds=60;
- new string[135],
- name[24],
- name2[24];
- new Text: Pozadina,
- Text: VoteKickTitle,
- Text: VoteKickName,
- Text: VoteKickVote,
- Text: VoteKickTime;
- //============================================================ONFILTERSCRIPTINIT
- public OnFilterScriptInit()
- {
- format(string, sizeof(string), "|||");
- Pozadina = TextDrawCreate(493.000000, 230.000000, string);
- TextDrawBackgroundColor(Pozadina, 0);
- TextDrawFont(Pozadina, 1);
- TextDrawLetterSize(Pozadina, 0.500000, 6.099999);
- TextDrawColor(Pozadina, 0);
- TextDrawSetOutline(Pozadina, 0);
- TextDrawSetProportional(Pozadina, 1);
- TextDrawSetShadow(Pozadina, 1);
- TextDrawUseBox(Pozadina, 1);
- TextDrawBoxColor(Pozadina, 1010580580);
- TextDrawTextSize(Pozadina, 616.000000, 0.000000);
- VoteKickTitle = TextDrawCreate(497.000000, 211.000000, "~g~-->~r~Kick~g~<--");
- TextDrawBackgroundColor(VoteKickTitle, 255);
- TextDrawFont(VoteKickTitle, 2);
- TextDrawLetterSize(VoteKickTitle, 0.660000, 2.599999);
- TextDrawColor(VoteKickTitle, -1);
- TextDrawSetOutline(VoteKickTitle, 1);
- TextDrawSetProportional(VoteKickTitle, 1);
- VoteKickVote = TextDrawCreate(555.000000, 254.000000, "~g~~h~Da~w~: 0 ~r~Ne~w~: 0");
- TextDrawAlignment(VoteKickVote, 2);
- TextDrawBackgroundColor(VoteKickVote, 255);
- TextDrawFont(VoteKickVote, 2);
- TextDrawLetterSize(VoteKickVote, 0.390000, 2.199999);
- TextDrawColor(VoteKickVote, -1);
- TextDrawSetOutline(VoteKickVote, 1);
- TextDrawSetProportional(VoteKickVote, 1);
- VoteKickTime = TextDrawCreate(601.000000, 273.000000, "60");
- TextDrawBackgroundColor(VoteKickTime, 255);
- TextDrawFont(VoteKickTime, 2);
- TextDrawLetterSize(VoteKickTime, 0.250000, 1.500000);
- TextDrawColor(VoteKickTime, -926365441);
- TextDrawSetOutline(VoteKickTime, 1);
- TextDrawSetProportional(VoteKickTime, 1);
- VoteKickName = TextDrawCreate(555.000000, 241.000000, "Player_Name");
- TextDrawAlignment(VoteKickName, 2);
- TextDrawBackgroundColor(VoteKickName, 255);
- TextDrawFont(VoteKickName, 1);
- TextDrawLetterSize(VoteKickName, 0.280000, 1.300000);
- TextDrawColor(VoteKickName, -1);
- TextDrawSetOutline(VoteKickName, 1);
- TextDrawSetProportional(VoteKickName, 1);
- return 1;
- }
- //===============================================================ONPLAYERCONNECT
- public OnPlayerConnect(playerid)
- {
- if(IsVoteKickStarted == true)
- {
- TextDrawShowForPlayer(playerid, Pozadina);
- TextDrawShowForPlayer(playerid, VoteKickTitle);
- TextDrawShowForPlayer(playerid, VoteKickName);
- TextDrawShowForPlayer(playerid, VoteKickVote);
- TextDrawShowForPlayer(playerid, VoteKickTime);
- return 1;
- }
- return 1;
- }
- //===========================================================ONPLAYERCOMMANDTEXT
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp("/glasaj", cmdtext, true))
- {
- if(IsVoteKickStarted == true) return SendClientMessage(playerid, COLOR_ERROR,"[Greska:] {BBBBBB}Jedno glasanje je upravo u toku, pricekaj da zavrsi pa zapocni novo glasanje.");
- ShowPlayerDialog(playerid, DIALOG_VOTEKICK, DIALOG_STYLE_INPUT, "{C14124}G{BBBBBB}lasanje", "{BBBBBB}Upisi {C14124}ID{BBBBBB} ili {C14124}Ime{BBBBBB} igraca kojeg zelis izbaciti.", "VoteKick", "Cancel");
- return 1;
- }
- return 1;
- }
- //============================================================ONPLAYERDISCONNECT
- public OnPlayerDisconnect(playerid)
- {
- if(PlayerToKick == playerid)
- {
- if(seconds > 0)
- {
- GetPlayerName(playerid, name, sizeof(name));
- format(string, sizeof(string), "{C14124}%s{BBBBBB} je napustio server pa je glasanje automatski prekinuto.", name);
- SendClientMessageToAll(COLOR_OK, string);
- Yes=0,No=0,PlayerToKick=-1, seconds=60, IsVoteKickStarted=false;
- TextDrawHideForAll(Pozadina);
- TextDrawHideForAll(VoteKickTitle);
- TextDrawHideForAll(VoteKickName);
- TextDrawHideForAll(VoteKickVote);
- TextDrawSetString(VoteKickVote,"~g~~h~Da~w~: 0 ~r~Ne~w~: 0");
- TextDrawHideForAll(VoteKickTime);
- }
- return 1;
- }
- return 1;
- }
- //==============================================================ONDIALOGRESPONSE
- public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
- {
- if(dialogid==DIALOG_VOTEKICK && response)
- {
- new string1[128];
- format(string, sizeof(string), ""GREEN"Upisi razlog zbog kojeg\nzelis izbaciti tog igraca.");
- if(IsVoteKickStarted == true) return SendClientMessage(playerid, COLOR_ERROR,"[Greska:] {BBBBBB}Jedno glasanje je upravo u toku, pricekaj da zavrsi pa zapocni novo glasanje.");
- if(IsNumeric(inputtext))
- {
- format(string1, sizeof(string1), "%s", inputtext);
- nput2 = string1;
- ShowPlayerDialog(playerid, rdialog, DIALOG_STYLE_INPUT, ""RED"Razlog:", string, "Start", "Cancel");
- }
- else
- {
- for(new i = 0; i<MAX_PLAYERS; i++)
- {
- GetPlayerName(playerid, name, sizeof(name));
- if(!strcmp(inputtext, name, true))
- {
- ShowPlayerDialog(playerid, rdialog, DIALOG_STYLE_INPUT, ""RED"Razlog:", string, "Start", "Cancel");
- break;
- }
- }
- }
- return 1;
- }
- if(dialogid==rdialog)
- {
- if(IsVoteKickStarted == true) return SendClientMessage(playerid, COLOR_ERROR,"[Greska:] {BBBBBB}Jedno glasanje je upravo u toku, pricekaj da zavrsi pa zapocni novo glasanje.");
- format(razlog, sizeof(razlog), ""RED"Razlog: "GREEN"%s", inputtext);
- StartVoteKick(strval(nput2));
- if(PlayerToKick == -1) return SendClientMessage(playerid, COLOR_ERROR, "[Greska]: {BBBBBB}Igrac nije online.");
- GetPlayerName(playerid, name2, sizeof(name2));
- format(string, sizeof(string), ""RED"%s"GREY" je zapoceo glasanje za izbacivanje igraca "RED"%s"GREY".", name2, name);
- SendClientMessageToAll(COLOR_OK, string);
- SendClientMessageToAll(COLOR_OK, razlog);
- SendClientMessageToAll(COLOR_OK, ""GREY"Upisi "GREEN"Da"GREY" ili "none"Ne"GREY" za glasanje.");
- return 1;
- }
- return 1;
- }
- //=================================================================STARTVOTEKICK
- stock StartVoteKick(playerid)
- {
- if(!IsPlayerConnected(playerid)) return 0;
- PlayerToKick = playerid;
- IsVoteKickStarted = true;
- TextDrawShowForAll(Pozadina);
- TextDrawShowForAll(VoteKickTitle);
- TextDrawShowForAll(VoteKickName);
- GetPlayerName(playerid,name,sizeof(name));
- TextDrawSetString(VoteKickName,name);
- TextDrawShowForAll(VoteKickVote);
- TextDrawShowForAll(VoteKickTime);
- for(new i = 0; i<MAX_PLAYERS; i++)
- HasPlayerVoted[i] = false;
- SetTimer("KickTimer",1000,false);
- return 1;
- }
- //======================================================================KICKTIME
- forward KickTimer();
- public KickTimer()
- {
- if(PlayerToKick == -1) return 1;
- if(seconds == 0) return EndVoteKick();
- seconds--;
- format(string,sizeof(string),"%02d",seconds);
- TextDrawHideForAll(VoteKickTime);
- TextDrawSetString(VoteKickTime, string);
- TextDrawShowForAll(VoteKickTime);
- SetTimer("KickTimer",1000,false);
- return 1;
- }
- //===================================================================ENDVOTEKICK
- stock EndVoteKick()
- {
- GetPlayerName(PlayerToKick, name, sizeof(name));
- if(Yes>No)
- {
- format(string, sizeof(string), "{C14124}%s {BBBBBB}je izbacen iz igre. [%d za DA | %d za NE]", name, Yes, No);
- SendClientMessageToAll(COLOR_OK, string);
- SendClientMessageToAll(COLOR_OK, razlog);
- Kick(PlayerToKick);
- }
- else
- {
- format(string, sizeof(string), "{C14124}%s {BBBBBB}nije izbacen iz igre. [%d za DA | %d za NE]", name, Yes, No);
- SendClientMessageToAll(COLOR_OK, string);
- }
- SendClientMessageToAll(COLOR_OK, string);
- Yes=0,No=0,PlayerToKick=-1, seconds=60, IsVoteKickStarted=false;
- TextDrawHideForAll(Pozadina);
- TextDrawHideForAll(VoteKickTitle);
- TextDrawHideForAll(VoteKickName);
- TextDrawHideForAll(VoteKickVote);
- TextDrawSetString(VoteKickVote,"~g~~h~Da~w~: 0 ~r~Ne~w~: 0");
- TextDrawHideForAll(VoteKickTime);
- return 1;
- }
- //=====================================================================ISNUMERIC
- stock IsNumeric(str[])
- {
- for(new i=0; i<strlen(str); i++)
- {
- if(str[i]<'0' || str[i]>'9')
- return 0;
- }
- return 1;
- }
- //==================================================================ONPLAYERTEXT
- public OnPlayerText(playerid, text[])
- {
- if(!strcmp("Da", text, true) && strlen(text)==strlen("Da") && IsVoteKickStarted == true && HasPlayerVoted[playerid] == false)
- {
- Yes++;
- HasPlayerVoted[playerid]= true;
- SendClientMessage(playerid, COLOR_OK, "[Glasanje]: {BBBBBB}Hvala vam na glasu!, glasali ste za Da! | +1");
- format(string,sizeof(string), "~g~~h~Da~w~: %d ~r~Ne~w~: %d", Yes, No);
- TextDrawHideForAll(VoteKickVote);
- TextDrawSetString(VoteKickVote,string);
- TextDrawShowForAll(VoteKickVote);
- return 0;
- }
- if(!strcmp("Ne", text, true) && strlen(text)==strlen("Ne") && IsVoteKickStarted == true && HasPlayerVoted[playerid] == false)
- {
- No++;
- HasPlayerVoted[playerid]= true;
- SendClientMessage(playerid, COLOR_OK, "[Glasanje]: {BBBBBB}Hvala na glasu, glasali ste za Ne! | +1");
- format(string,sizeof(string), "~g~~h~Da~w~: %d ~r~Ne~w~: %d", Yes, No);
- TextDrawHideForAll(VoteKickVote);
- TextDrawSetString(VoteKickVote,string);
- TextDrawShowForAll(VoteKickVote);
- return 0;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment