0 Members and 6 Guests are viewing this topic.
{'!a2': begin WriteConsole(0,'Arena2 oylaması baslatmak icin',RGB(0,255,255)); command('/votemap Arena2'); StartVoteMap(ID, 'Arena2') end; '!hamsrun': begin WriteConsole(0,'Hamsrun oylaması baslatmak icin',RGB(0,255,255)); command('/votemap hamsrun'); StartVotemap(ID, 'hamsrun') end;) '!lg': begin WriteConsole(0,'Lagrange oylaması baslatmak icin',RGB(0,255,255)); command('/votemap Lagrange'); StartVoteMap(ID, 'Lagrange') end;}
procedure OnPlayerSpeak(ID: Byte; Text: string);begincase lowercase(Text) of'!a2': begin WriteConsole(0,'Arena2 oylaması baslatmak icin',RGB(0,255,255)); command('/votemap Arena2'); StartVoteMap(ID, 'Arena2') end; '!hamsrun': begin WriteConsole(0,'Hamsrun oylaması baslatmak icin',RGB(0,255,255)); command('/votemap hamsrun'); StartVotemap(ID, 'hamsrun') end; '!lg': begin WriteConsole(0,'Lagrange oylaması baslatmak icin',RGB(0,255,255)); command('/votemap Lagrange'); StartVoteMap(ID, 'Lagrange') end; end; end;
function gettime(ticks:integer):string;var minutes,seconds:integer;begin minutes := round(ticks / 3600); seconds := round(ticks mod 3600); result := inttostr(minutes)+' minutes and '+inttostr(seconds)+' seconds';end;procedure onplayerspeak(id:byte; text:string);begin if gettickcount() mod 7200 = 0 then case lowercase(Text) of '!a2': begin writeconsole(0,'Arena2 oylaması baslatmak icin',rgb(0,255,255)); command('/votemap Arena2'); startvotemap(id,'Arena2') end; '!hamsrun': begin writeconsole(0,'Hamsrun oylaması baslatmak icin',rgb(0,255,255)); command('/votemap hamsrun'); startvotemap(id,'hamsrun') end; '!lg': begin writeconsole(0,'Lagrange oylaması baslatmak icin',rgb(0,255,255)); command('/votemap Lagrange'); startvotemap(id,'Lagrange') end; end else writeconsole(id,gettime(gettickcount())+' left until you can vote again.',$cc0000);end;
(Finally a use for my gettime() function!)Code: (pascal) [Select]function gettime(ticks:integer):string;var minutes,seconds:integer;begin minutes := round(ticks / 3600); seconds := round(ticks mod 3600); result := inttostr(minutes)+' minutes and '+inttostr(seconds)+' seconds';end;procedure onplayerspeak(id:byte; text:string);begin if gettickcount() mod 7200 = 0 then case lowercase(Text) of '!a2': begin writeconsole(0,'Arena2 oylaması baslatmak icin',rgb(0,255,255)); command('/votemap Arena2'); startvotemap(id,'Arena2') end; '!hamsrun': begin writeconsole(0,'Hamsrun oylaması baslatmak icin',rgb(0,255,255)); command('/votemap hamsrun'); startvotemap(id,'hamsrun') end; '!lg': begin writeconsole(0,'Lagrange oylaması baslatmak icin',rgb(0,255,255)); command('/votemap Lagrange'); startvotemap(id,'Lagrange') end; end else writeconsole(id,gettime(gettickcount())+' left until you can vote again.',$cc0000);end;Please note that players will not be able to vote a map until 2 minutes have passed after a new match started.
const time_till_vote = 2; // Time until players can vote again (in minutes)var vote_enabled:boolean;function gettime(ticks:integer):string;var minutes,seconds:integer;begin minutes := round(ticks / 3600); seconds := round(ticks mod 3600); result := inttostr(minutes)+' minutes and '+inttostr(seconds)+' seconds';end;procedure onplayerspeak(id:byte; text:string);begin if vote_enabled then begin case lowercase(text) of '!commands': writeconsole(id,'!a2, !hamsrun, !lg',$ffffff); '!a2': begin writeconsole(0,'Arena2 oylaması baslatmak icin',$00ffff); command('/votemap Arena2'); end; '!hamsrun': begin writeconsole(0,'Hamsrun oylaması baslatmak icin',$00ffff); command('/votemap hamsrun'); end; '!lg': begin writeconsole(0,'Lagrange oylaması baslatmak icin',$00ffff); command('/votemap Lagrange'); end; end; vote_enabled := false; end else writeconsole(id,gettime(gettickcount())+' left until you can vote again.',$cc0000);end;procedure apponidle(ticks:integer);begin if ticks mod (3600 * time_till_vote) = 0 then vote_enabled := true;end;procedure onmapchange(newmap:string);begin vote_enabled := false;end;
Try the below code. It is 100% working. If it - for whatever the log says - crashes the server, it's because you pasted it to the wrong place. Save the code below in a file of type '.pas' (without the 's) in a new folder in 'SCRIPTS' and create a text file called 'includes'. Write the name and the file extension into this text file. If you call the file containing the code 'core.pas', then you have to write 'core.pas'. If the name of the file containing the code does not show the extension '.pas', that makes no difference. You still write 'core.pas' into the file 'Includes.txt'. I hope it's working now for you. Else I'll actually have to put all this stuff in a .rar archieve for you and explain how you extract it to the 'SCRIPTS' folder, and I sure would like to do that, but not as much as I would not to do it. Code: (pascal) [Select]const time_till_vote = 2; // Time until players can vote again (in minutes)var vote_enabled:boolean;function gettime(ticks:integer):string;var minutes,seconds:integer;begin minutes := round(ticks / 3600); seconds := round(ticks mod 3600); result := inttostr(minutes)+' minutes and '+inttostr(seconds)+' seconds';end;procedure onplayerspeak(id:byte; text:string);begin if vote_enabled then begin case lowercase(text) of '!commands': writeconsole(id,'!a2, !hamsrun, !lg',$ffffff); '!a2': begin writeconsole(0,'Arena2 oylaması baslatmak icin',$00ffff); command('/votemap Arena2'); end; '!hamsrun': begin writeconsole(0,'Hamsrun oylaması baslatmak icin',$00ffff); command('/votemap hamsrun'); end; '!lg': begin writeconsole(0,'Lagrange oylaması baslatmak icin',$00ffff); command('/votemap Lagrange'); end; end; vote_enabled := false; end else writeconsole(id,gettime(gettickcount())+' left until you can vote again.',$cc0000);end;procedure apponidle(ticks:integer);begin if ticks mod (3600 * time_till_vote) = 0 then vote_enabled := true;end;procedure onmapchange(newmap:string);begin vote_enabled := false;end;
procedure onplayerspeak(id:byte; text:string);begin case lowercase(text) of '!commands': writeconsole(id,'!a2, !hamsrun, !lg',$ffffff); '!a2': begin writeconsole(0,'Arena2 oylaması baslatmak icin',$00ffff); command('/votemap Arena2'); end; '!hamsrun': begin writeconsole(0,'Hamsrun oylaması baslatmak icin',$00ffff); command('/votemap hamsrun'); end; '!lg': begin writeconsole(0,'Lagrange oylaması baslatmak icin',$00ffff); command('/votemap Lagrange'); end; end; end;
Man man man Sorry for all but it needed another command, if you type !a2; you will see what should you do for vote, but I want that if you type !a2, automatically open vote not needed + /votemap ...Sorry but I cant do it :/EDIT: Man, I try that "procedure startvotemap" and if player type !arena2 or !hamsrun or !lagrange, automatically starts vote. Not needed /votemap arena2. Only !arena2 must open vote for arena2. It is what I want :/ As toyux's script, if you type !vote, arena2 vote starts.
const//max playersMAXPLAYER = 32;//vote config Percent = 75;InitTime = 30; // a starting time of voting for the next mapAddTime = 8; varVoted: array[1..MAXPLAYER] of boolean;Time: integer;procedure OnPlayerSpeak(ID: byte; Text: string);var i,Total: integer;beginif (LowerCase(Text) = '!arena2') or (LowerCase(Text) = '!a2') then begin if Voted[ID] then WriteConsole(ID, 'You have already voted!',rgb(255,0,0)) else if (Time = 0) then Time := InitTime else Time := Time + Addtime; Voted[ID] := true; for i := 1 to MAXPLAYER do if (GetPlayerStat(i, 'Active') = true) and (Voted[i]) then Total := Total + 1; if ((100 * Total) / NumPlayers >= Percent) then begin for i := 1 to MAXPLAYER do Voted[ID] := false; WriteConsole(0, 'Nextmap vote passed.', rgb(255,255,255)); Command('/map Arena2'); end else WriteConsole(0,FloattoStr(RoundTo(100 * Total / NumPlayers, 1))+ '% / '+ InttoStr(Percent) + '%', rgb(255,255,255)); end;end;
Delete everything in the .pas file and copy the below code into the now empty file. Compiled and will work to a 100%Code: (pascal) [Select]procedure onplayerspeak(id:byte; text:string);begin case lowercase(text) of '!commands': writeconsole(id,'!a2, !hamsrun, !lg',$ffffff); '!a2': begin writeconsole(0,'Arena2 oylaması baslatmak icin',$00ffff); command('/votemap Arena2'); end; '!hamsrun': begin writeconsole(0,'Hamsrun oylaması baslatmak icin',$00ffff); command('/votemap hamsrun'); end; '!lg': begin writeconsole(0,'Lagrange oylaması baslatmak icin',$00ffff); command('/votemap Lagrange'); end; end; end;
procedure OnPlayerSpeak(ID: byte; Text: string);var Mapname, Reason: string;beginif (Text = '!arena2') then begin if FileExists('maps/Arena2.pms') or FileExists('maps/Arena2.PMS') then begin StartVoteMap('Arena2', ' Vote'); end; end;end;
Man, you dont understand, I want open normal vote like press esc menu with !a2, no vote with %, if you type !a2, normal vote must open. Last edit is working;...But it is working with /votemap arena2, I want !arena2 only, okay?