Author Topic: !Nextmap problem  (Read 1645 times)

0 Members and 1 Guest are viewing this topic.

Offline Mercury92

  • Camper
  • ***
  • Posts: 284
!Nextmap problem
« on: April 01, 2010, 08:23:29 am »
Using DorkeyDear sript !Nextmap.
http://forums.soldat.pl/index.php?topic=19031.0

Getting errors at random time:
Code: (Pascal) [Select]
►             [*] [Error] Nextmap -> (OnPlayerSpeak): Invalid Type
►             [*] [Error] Nextmap -> (AppOnIdle): Access violation at address 00453BD7 in module 'soldatserver.exe'. Read of address 00000106
► c 15:59:00 [*] Too many script errors! Shutting down server -> "Nextmap"

Also script is bot modified:
Code: (Pascal) [Select]
procedure OnPlayerSpeak(ID: byte; Text: string);
var
  i, Total: byte;
begin
  if ((LowerCase(Text) = '!nextmap') and (Enable)) then begin
    if Voted[ID] then WriteConsole(ID, 'You have already voted.', Color) else if (Time = 0) then Time := InitTime else Time := Time + Addtime;
    Voted[ID] := true;
    for i := 1 to 32 do if (GetPlayerStat(i, 'Active') = true) and (Voted[i]) then Total := Total + 1;
    if (100 * Total / (NumPlayers - NumBots) >= VotePerc) then begin
      for i := 1 to 32 do Voted[ID] := false;
      DisableVoteNext;
      WriteConsole(0, 'Nextmap vote passed', Color);
      Command('/nextmap');
    end else WriteConsole(0,FloattoStr(RoundTo(100 * Total / (NumPlayers - NumBots), 2)) + '% / ' + InttoStr(VotePerc) + '% required for a vote pass', Color);
  end;

//modified script
    if regExpMatch('^/(commands|shop|spawn|help|vest|clust|serk|flame|stat)$', Text) then
    begin
writeconsole(ID, 'Press the command button [/]', Color);
writeconsole(ID, 'You cannot enter command with the chat button [default T]', Color);
end;

if regExpMatch('^!(commands|shop|spawn|help|vest|clust|serk|flame|stat)$', Text) then
    begin
writeconsole(ID, 'Press the command button [/]', Color);
writeconsole(ID, 'You cannot enter command with the chat button [default T]', Color);
end;
end;

ScriptCore: 2.6.5
[saw]  on 1.5.1

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: !Nextmap problem
« Reply #1 on: April 01, 2010, 08:37:03 am »
Put your script into a seperate script folder instead of adding into an existing file from someone else, way better ;)

Attached my !nextmap script, feel free to use as long you mentoin me as the author.