SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 15/12/2010, 01:47 AM   #1
admantis
High-roller
 
Join Date: Sep 2009
Posts: 2,524
Reputation: 449
Default SetWorldTime is not working [HELP]

Hello all again
Now I have a error here, well, actually not errors or warnings, just a bugged script.

pawn Code:
new WorldTime;
public OnGameModeInit()
{

    SetTimer("SetHour", 5000, 1); // 3600000 = 1 hour in ms - Time was set to 5000 ms for testing purposes.
    WorldTime = SetWorldTime(random(24));
}

pawn Code:
forward SetHour()
public SetHour()
{
    if (WorldTime == 24) WorldTime = 0;
    SetWorldTime((WorldTime)+1);
}

However when I go ingame nothing happens. Thought the time is properly set to a random number upto 24, it won't change every 5000 ms - 5 seconds.

EDIT: I need help really, bcs now I found out time will be set only to hour 24 OnGameModeInit.
Thanks to everyone
admantis is offline  
Old 15/12/2010, 02:05 AM   #2
XePloiT
Huge Clucker
 
XePloiT's Avatar
 
Join Date: Nov 2010
Posts: 299
Reputation: 0
Default Re: SetWorldTime is not working [HELP]

i have this exact problem...this is happened after i installed 0.3c...
i this its something with the development... :\
__________________
You can find me as "AlExEy" in other forums and places.
"Sex is always the answer, it's never a question,'Cause the answer is yes"
Code:
[ r? ] - 0% [ rAdmin + rBank ] - 99% [ rVehHouse - rHouse + rVehicle ] - 99% [ rWeapon + rExp ] - 5% [ rClan ] - 50% The Whole [ rSystem ] - 63% 100% Dynamic & 100% MySql Database Why 99%? - Cuz Nothin' is Perfect. Releases: rVote - Voting/Poll Script

XePloiT is offline  
Old 15/12/2010, 02:06 AM   #3
admantis
High-roller
 
Join Date: Sep 2009
Posts: 2,524
Reputation: 449
Default Re: SetWorldTime is not working [HELP]

Quote:
Originally Posted by XePloiT View Post
i have this exact problem...this is happened after i installed 0.3c...
i this its something with the development... :\
Ye but im working on 0.3b now not 0.3c
admantis is offline  
Old 15/12/2010, 02:16 AM   #4
XePloiT
Huge Clucker
 
XePloiT's Avatar
 
Join Date: Nov 2010
Posts: 299
Reputation: 0
Default Re: SetWorldTime is not working [HELP]

Quote:
Originally Posted by admantis View Post
Ye but im working on 0.3b now not 0.3c
ow...try this...
pawn Code:
public OnGameModeInit()
{
    WorldTime = SetWorldTime(random(24));// this before the timer
    SetTimer("SetHour", 5000, 1); // 3600000 = 1 hour in ms - Time was set to 5000 ms for testing purposes.
}
forward SetHour()
public SetHour()
{
    if (WorldTime == 24) WorldTime = 0;
    SetWorldTime((WorldTime)+1);
    return SetTimer(SetHour,"5000",false); // if its doesn't work remove this line and try again...
    // + i don't this its gonna work cuz i think that OnGameModeInit() is only when its loads the GM...
   //just use gl_realtime that comes with the server files... this is will change the time every one hour(in game)
}
__________________
You can find me as "AlExEy" in other forums and places.
"Sex is always the answer, it's never a question,'Cause the answer is yes"
Code:
[ r? ] - 0% [ rAdmin + rBank ] - 99% [ rVehHouse - rHouse + rVehicle ] - 99% [ rWeapon + rExp ] - 5% [ rClan ] - 50% The Whole [ rSystem ] - 63% 100% Dynamic & 100% MySql Database Why 99%? - Cuz Nothin' is Perfect. Releases: rVote - Voting/Poll Script

XePloiT is offline  
Old 15/12/2010, 02:18 AM   #5
MaRcOsWeB
Huge Clucker
 
MaRcOsWeB's Avatar
 
Join Date: Nov 2010
Location: Paraná, Entre Rios, Argentina
Posts: 248
Reputation: 12
Default Respuesta: SetWorldTime is not working [HELP]

SetPlayerTime(playerid,0,0); // to set the time to playerid.

This is what I guess might work to do that action, you should try it, it might work
MaRcOsWeB is offline  
Old 15/12/2010, 02:27 AM   #6
XePloiT
Huge Clucker
 
XePloiT's Avatar
 
Join Date: Nov 2010
Posts: 299
Reputation: 0
Default Re: Respuesta: SetWorldTime is not working [HELP]

Quote:
Originally Posted by MaRcOsWeB View Post
SetPlayerTime(playerid,0,0); // to set the time to playerid.

This is what I guess might work to do that action, you should try it, it might work
SetPlayerTime sets the time for one player...if he want to use this he'll have to make a loop...
SetWorldTime is sets it for everyone
__________________
You can find me as "AlExEy" in other forums and places.
"Sex is always the answer, it's never a question,'Cause the answer is yes"
Code:
[ r? ] - 0% [ rAdmin + rBank ] - 99% [ rVehHouse - rHouse + rVehicle ] - 99% [ rWeapon + rExp ] - 5% [ rClan ] - 50% The Whole [ rSystem ] - 63% 100% Dynamic & 100% MySql Database Why 99%? - Cuz Nothin' is Perfect. Releases: rVote - Voting/Poll Script

XePloiT is offline  
Old 15/12/2010, 02:56 AM   #7
Scenario
Godfather
 
Scenario's Avatar
 
Join Date: Feb 2010
Location: Heaven
Posts: 7,801
Reputation: 701
Default Re: SetWorldTime is not working [HELP]

I am having no issues with this function and I am using 0.3c RC4-2-2. You need to make sure that you have used "TogglePlayerClock" for each player who joins the server. If you didn't, this function will not work. Alternatively, you could perform a loop through all of your online players and use "SetPlayerTime"; as mentioned by the above poster.
Scenario is offline  
Old 15/12/2010, 04:10 AM   #8
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,593
Reputation: 379
Default Re: SetWorldTime is not working [HELP]

Quote:
Originally Posted by admantis View Post
Hello all again
Now I have a error here, well, actually not errors or warnings, just a bugged script.

pawn Code:
new WorldTime;
public OnGameModeInit()
{

    SetTimer("SetHour", 5000, 1); // 3600000 = 1 hour in ms - Time was set to 5000 ms for testing purposes.
    WorldTime = SetWorldTime(random(24));
}

pawn Code:
forward SetHour()
public SetHour()
{
    if (WorldTime == 24) WorldTime = 0;
    SetWorldTime((WorldTime)+1);
}

However when I go ingame nothing happens. Thought the time is properly set to a random number upto 24, it won't change every 5000 ms - 5 seconds.

EDIT: I need help really, bcs now I found out time will be set only to hour 24 OnGameModeInit.
Thanks to everyone
You're not increasing your "WorldTime" variable


pawn Code:
forward SetHour()
public SetHour()
{
    if (WorldTime == 24) WorldTime = 0;
    SetWorldTime((WorldTime)+1);
    WorldTime++;
}
Joe Staff is offline  
 

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
SetWorldTime question... sean5874 Help Archive 0 18/02/2010 03:16 PM
SetPlayerTime & SetWorldTime. Miguel Help Archive 6 17/02/2010 05:29 PM
SetWorldTime to your own time possible? Meebly Help Archive 3 04/12/2009 05:03 PM
SetWorldTime DeerHooves Help Archive 1 02/03/2009 06:10 AM


All times are GMT. The time now is 07:52 PM.


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