0 Members and 1 Guest are viewing this topic.
Ohh thanks a lot, it's working now, but always; I want learn how did you do it?But so far, I didnt learn anything yet
Edit: Can you correct this script? (nextmap vote)
Ohh thanks a lot, it's working now, but always; I want learn how did you do it?But so far, I didnt learn anything yetEdit: Can you correct this script? (nextmap vote)
//Nextmap Voter Script, v1.2.0, by Squiddy ~ [BR]constcolor = $FF7F00; //cor a ser usada.errorcolor = $FF0000; //cor dos erros.voteperc = 65; //porcentagem necessária para mudar de mapa.vartotal, votetime: integer;voting: boolean;voted: array[1..32] of boolean;//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//go!function getvotestat(converttostring: boolean): variant;var int: integer;beginint := round(100 * total / ((numplayers - numbots) - spectators));result := iif(converttostring,'Current ballot: '+inttostr(int)+'/'+inttostr(voteperc)+'%',int);end;procedure resetvotestats(resetids: boolean);var s: byte;begintotal := 0;votetime := 0;voting := false;if resetids then for s := 1 to 32 do voted[s] := false;end;procedure addvoter(id: byte);beginvoted[id] := true;total := total + 1;writeconsole(0,getvotestat(true),color);votetime := 20;if getvotestat(false) >= voteperc then begin resetvotestats(true); command('/nextmap'); end;end;procedure removevoter(id: byte);beginif voted[id] then total := total - 1;voted[id] := false;votetime := 20;end;//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~procedure activateserver();beginresetvotestats(true);end;procedure onplayerspeak(id: byte; text: string);begintext := lowercase(text);if (text = '!nextmap') or (text = '!vote') or (text = '!nm') then begin if not voting then begin if getplayerstat(id,'team') <> 5 then begin voting := true; writeconsole(0,'The vote for the next map ('+nextmap+') started!',color); addvoter(id); end else writeconsole(id,'You can not vote as a spectator!',errorcolor); end else if not voted[id] then begin if getplayerstat(id,'team') <> 5 then addvoter(id) else writeconsole(id,'You can not vote as a spectator!',errorcolor); end else writeconsole(id,'You have already voted!',errorcolor); end;end;procedure apponidle(ticks: integer);beginif (((numplayers - numbots) - spectators) = 0) or (voting = false) then exit;if getvotestat(false) < voteperc then begin if votetime > 0 then votetime := votetime - 1 else begin writeconsole(0,'The vote for the map "'+nextmap+'" ended '+inttostr(getvotestat(false))+'/'+inttostr(voteperc)+'%',errorcolor); resetvotestats(true); end; end;end;procedure onjoingame(id, team: byte);beginvoted[id] := false;end;procedure onleavegame(id, team: byte; kicked: boolean);beginif voting then removevoter(id);end;procedure onmapchange(newmap: string);beginif voting then resetvotestats(true);end;