Game time
#1

I want to set my money bag should be start at game hour 5.

I mean,

if (GameHour == 5)

PHP код:
CMD:moneybag(playerid,params[])
{
            if(
iseventstarted == true)SendClientMessage(playerid,0xff0000ff,"The Money Bag has already started");
            else
            {
                    
DestroyDynamicPickup(MoneyPickup); //used to remove last pickup used
                     
new Rand random(sizeof(MBagLocations));
                    
xx MBagLocations[Rand][XX];
                    
yy MBagLocations[Rand][YY];
                    
zz MBagLocations[Rand][ZZ];
                    
MoneyBagPay MBagLocations[Rand][Pay];
                    
MoneyPickup CreateDynamicPickup(15502,xx,yy,zz, -1, -1, -11000.0);
                    
SendClientMessageToAll(COLOR_CYAN,"The Money Bag has started.");
                    
format(town,128"The money bag is nearest to %s",MBagLocations[Rand][area]);
                    
format(location128"The money bag is in %s",MBagLocations[Rand][loc]);
                    
timer_mb_1=SetTimer("moneybag1"60*8000false);
                    
iseventstarted true;
            }
            return 
1;

I want this cmd moneybag should be apply in gamehour 5. How can i set it on game hour 5
Reply
#2

First, you need to make a time system in order to do this, secondly, check if the time is 5 and make it automatically starts.
Reply
#3

Try this
In your command:
PHP код:
for(new 0;MAX_PLAYERS;i++)
{
    new 
hourminutes;
    if(
GetPlayerTime(ihourminutes) == //The time you want)
    

I'm not sure but try
Reply
#4

I have already time but i want to know how can i set moneybag on gamehour 5.?
Reply
#5

If your time system uses a timer, show me the functions of this timer..
Reply
#6

Let the server control the gametime, example:
PHP код:
#include <a_samp>
new
    
gametime,
    
worldtime 0;
forward UpdateTime();
public 
OnFilterScriptInit(){
    
SetWorldTime(worldtime);
    
gametime SetTimer("UpdateTime",60*1000,true);
    
    return 
1;
}
public 
OnFilterScriptExit(){
    
KillTimer(gametime);
    
    return 
1;
}
public 
UpdateTime(){
    if(
worldtime == 23){
    
        
worldtime 0;
        
SetWorldTime(worldtime);
    }
    else{
    
        
worldtime ++;
        
SetWorldTime(worldtime);
    }
    
    switch(
worldtime){ // An if statement would be fine if you'd like, but less editing would be needed if you wanted to add more time based events later.
        
case 5// Either call your moneybag function (if you have it) or just code it under this.
    
}
    return 
1;

Reply
#7

You guyz are getting my wrong.

I have time system already and i don't need time system

Look, I have money bag system and it get started when i do /moneybag .
I want to set money bag at game clock 5:00. It should be start at 5:00 game clock.

Here's money codes;

PHP код:
CMD:moneybag(playerid,params[]) 

            if(
iseventstarted == true)SendClientMessage(playerid,0xff0000ff,"The Money Bag has already started"); 
            else 
            { 
                    
DestroyDynamicPickup(MoneyPickup); //used to remove last pickup used 
                     
new Rand random(sizeof(MBagLocations)); 
                    
xx MBagLocations[Rand][XX]; 
                    
yy MBagLocations[Rand][YY]; 
                    
zz MBagLocations[Rand][ZZ]; 
                    
MoneyBagPay MBagLocations[Rand][Pay]; 
                    
MoneyPickup CreateDynamicPickup(15502,xx,yy,zz, -1, -1, -11000.0); 
                    
SendClientMessageToAll(COLOR_CYAN,"The Money Bag has started."); 
                    
format(town,128"The money bag is nearest to %s",MBagLocations[Rand][area]); 
                    
format(location128"The money bag is in %s",MBagLocations[Rand][loc]); 
                    
timer_mb_1=SetTimer("moneybag1"60*8000false); 
                    
iseventstarted true
            } 
            return 
1

here's my clock system
PHP код:
forward GameModeClock(); ///clock start
public GameModeClock()
{
    new 
string[256],string2[128];

    
GameMinute ++;

    if (
GameMinute == 60)
    {
    
GameMinute 0;
    
GameHour ++;
    
SetWorldTime(GameHour);
    
GameWeather ++;

    if (
GameWeather == 5)
    {
    new 
weatherid random(MAX_WEATHER);
    
SetWeather(RandomWeather[weatherid][0]);
    
GameWeather 0;
    }

    }

    if (
GameHour == 24)
    {
    
GameMinute 0;
    
GameHour 0;
    
GameDay ++;
    }

    
format(stringsizeof(string), "%s",WeekDays[GameDay]);
    
TextDrawSetString(DaysOfWeekstring);

    if (
GameHour 10)
    
format(stringsizeof(string), "0%d",GameHour);
    else
    
format(stringsizeof(string), "%d",GameHour);

    if (
GameMinute 10)
    
format(stringsizeof(string), "%s:0%d",string,GameMinute);
    else
    
format(stringsizeof(string), "%s:%d",string,GameMinute);

    
TextDrawSetString(Clockstring);


    if (
GameHour 10)
    
format(stringsizeof(string), "%s, 0%d",WeekDays[GameDay],GameHour);
    else
    
format(stringsizeof(string), "%s, %d",WeekDays[GameDay],GameHour);

    if (
GameMinute 10)
    
format(stringsizeof(string), "%s:0%d",string,GameMinute);
    else
    
format(stringsizeof(string), "%s:%d",string,GameMinute);


    if (
GameMinute == 0)
    {
    
format(stringsizeof(string), "%s",string);
    
//printf(string);

    
format(string2sizeof(string2), "worldtime %s",string);
    
SendRconCommand(string2);

    
format(stringsizeof(string), "{FFFFFF}Game Time: {BDBDBD}%s",string);
    
SendClientMessageToAll(ROJOstring);
    }
}
///clock ends 
Reply
#8

you didn't say that but eh,

just add something under your timer like:
PHP код:
if(GameHour == && GameMinute == 0){ //Continue your code below. 
Reply
#9

sdasadd
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)