SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 20/12/2011, 04:25 AM   #1
Ballu Miaa
High-roller
 
Ballu Miaa's Avatar
 
Join Date: Apr 2010
Location: New Delhi,India
Posts: 1,915
Reputation: 315
Default Game Mode change Bug help![rep+]

I have a TDM server , My script restart's the server/change's the GM after every 30 mins! It give's BattleWin message's and save score's! Everything use to work well. But now if noone logs into the server when a Round start's of 30 minutes. The server doesnt restart automatically! It works when i go InGame and check everything. But when there is noone in the server it doesnt do anything! I've set lot of timers to Change the game mode after 30 Minutes if one timer doesnt change it. But no helps nothing works if no one in the server.
I've used both SendRconCommand("changemode CWLS") as well as GameModeExit() , I dont know what is wrong. This function use to work well! Please help


pawn Code:
// Under OnGameModeInit()
SetTimer("GameModeChanger", 30 * 60 * 1000, 0);

forward GameModeChanger();
public GameModeChanger()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            DisablePlayerCheckpoint(i);
            OnPlayerDataSave(i);
            BattleWin();
            SendClientMessage(i, 0x66a2ff97,"* The Next Battle will start soon, dont keep your weapons away!");
            TogglePlayerControllable(i, 0);
            new Float:B,Float:C,Float:D;
            GetPlayerCameraPos(i,B,C,D);
            SetPlayerCameraPos(i,B-2,C-1,D+3);
            SetTimer("Changemode", 10 * 1000 , 0);
            dini_IntSet("CW/Scores.txt", "IndiaScore", IndiaScore);
            dini_IntSet("CW/Scores.txt", "USScore", USScore);
            dini_IntSet("CW/Scores.txt", "RusScore", RusScore);
            dini_IntSet("CW/Scores.txt", "PakScore", PakScore);
            dini_IntSet("CW/Scores.txt", "UKScore", UKScore);
        }
    }
}
forward Changemode();
public Changemode()
{
    SendRconCommand("changemode CWLS");
    return 1;
}
__________________
I successfully reset password for my account and retrieved it after a few months.

I am back on work!



I will take half payment as an advance to script for you.
Click here to request my Scripting Service.

Ballu Miaa is offline   Reply With Quote
Old 20/12/2011, 04:44 AM   #2
JamesC
Huge Clucker
 
JamesC's Avatar
 
Join Date: Jul 2010
Location: New Zealand
Posts: 242
Reputation: 31
Default Re: Game Mode change Bug help![rep+]

Take SetTimer("Changemode", 10 * 1000 , 0); out of the loop. If you call it there, it will only work if a player is connected. Also, You don't need to set a timer. Just save all the data, then call the Changemode function.
__________________


JamesC is offline   Reply With Quote
Old 20/12/2011, 06:36 AM   #3
suhrab_mujeeb
Guest
 
Posts: n/a
Default Re: Game Mode change Bug help![rep+]

You are using the timer inside the loop. Take it out of the loop to the head of the call back and you are done.
  Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change game-mode and add admins commands to samp Polomikey Server Support 16 03/12/2011 08:40 PM
Server Mode Change Help! eеe Scripting Help 4 20/11/2011 02:04 PM
How do I change game-mode name? Andy_McKinley Help Archive 1 06/11/2009 11:25 AM


All times are GMT. The time now is 09:21 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.