Author Topic: How can I clear them?  (Read 2819 times)

0 Members and 1 Guest are viewing this topic.

Offline MrHamsTR

  • Soldier
  • **
  • Posts: 209
  • One day, everything will end..
Re: How can I clear them?
« Reply #20 on: January 22, 2013, 03:20:27 pm »
Yeah, it's working but not all.
It's writing again %0.00000000 when died.
Is there anybody can write script?
Good, go and play soldat ^^

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: How can I clear them?
« Reply #21 on: January 22, 2013, 11:32:18 pm »
Try this one then.
www.soldatx.com.br - The brazilian Soldat community.

Offline MrHamsTR

  • Soldier
  • **
  • Posts: 209
  • One day, everything will end..
Re: How can I clear them?
« Reply #22 on: January 23, 2013, 05:52:22 am »
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)
« Last Edit: January 23, 2013, 06:07:02 am by MrHamsTR »
Is there anybody can write script?
Good, go and play soldat ^^

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: How can I clear them?
« Reply #23 on: January 23, 2013, 02:23:19 pm »
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
You did learn nothing because you know nothing about scripting, atleast from what I can see.

Here is my advice when you want to learn something:

If you want to learn some basics about scripts you should check this out: How to Write a Soldat Script

When you have gathered some basic knowledge you should go ahead and download (simple) scripts from the Scripting Releases section,

then try to understand them and learn from the code what you can do in which way.

It's important that you try out simple things, even when they are not useful for anyone, you will learn from it.

After you've gone through these steps you should be able to understand these bigger scripts like ZRPG from HackTank and be able to fix things by yourself.

This worked for me and probably for the most other people which have been writing soldat scripts in the past.

Edit: Can you correct this script? (nextmap vote)
First of all, you may do what I've said above.

After you have done that, you should try to fix the script by yourself.

When you have no success, give us some information about the errors when you start the server.

You will learn scripting better this way.
« Last Edit: January 23, 2013, 02:24:59 pm by Swompie »

Offline rOy

  • Soldier
  • **
  • Posts: 120
Re: How can I clear them?
« Reply #24 on: January 23, 2013, 04:56:39 pm »
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)

Hey

Now I do not know what the problem is...
If it does not write % of what?
In that script missing (end time) - for vote
I've Nextmap script (from Squiddy) and en from idk who.

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: How can I clear them?
« Reply #25 on: January 23, 2013, 05:01:30 pm »
Swompie said it all.
www.soldatx.com.br - The brazilian Soldat community.

Offline rOy

  • Soldier
  • **
  • Posts: 120
Re: How can I clear them?
« Reply #26 on: January 23, 2013, 05:42:38 pm »
Author: Mr.Squiddy
Core: 2.7.3 - server [1.6.3 soldat]
Translate: rOy

Code: [Select]
//Nextmap Voter Script, v1.2.0, by Squiddy ~ [BR]

const
color = $FF7F00; //cor a ser usada.
errorcolor = $FF0000; //cor dos erros.
voteperc = 65; //porcentagem necessária para mudar de mapa.

var
total, votetime: integer;
voting: boolean;
voted: array[1..32] of boolean;

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//go!

function getvotestat(converttostring: boolean): variant;
var int: integer;
begin
int := round(100 * total / ((numplayers - numbots) - spectators));
result := iif(converttostring,'Current ballot: '+inttostr(int)+'/'+inttostr(voteperc)+'%',int);
end;

procedure resetvotestats(resetids: boolean);
var s: byte;
begin
total := 0;
votetime := 0;
voting := false;
if resetids then for s := 1 to 32 do voted[s] := false;
end;

procedure addvoter(id: byte);
begin
voted[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);
begin
if voted[id] then total := total - 1;
voted[id] := false;
votetime := 20;
end;

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

procedure activateserver();
begin
resetvotestats(true);
end;

procedure onplayerspeak(id: byte; text: string);
begin
text := 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);
begin
if (((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);
begin
voted[id] := false;
end;

procedure onleavegame(id, team: byte; kicked: boolean);
begin
if voting then removevoter(id);
end;

procedure onmapchange(newmap: string);
begin
if voting then resetvotestats(true);
end;

DOWNLOAD:
« Last Edit: January 24, 2013, 05:19:29 am by rOy »

Offline MrHamsTR

  • Soldier
  • **
  • Posts: 209
  • One day, everything will end..
Re: How can I clear them?
« Reply #27 on: January 24, 2013, 02:14:41 am »
No, nextmap has same problem that %0.00000000.
Is there anybody can write script?
Good, go and play soldat ^^