Game time -
sscarface - 24.06.2015
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(1550, 2,xx,yy,zz, -1, -1, -1, 1000.0);
SendClientMessageToAll(COLOR_CYAN,"The Money Bag has started.");
format(town,128, "The money bag is nearest to %s",MBagLocations[Rand][area]);
format(location, 128, "The money bag is in %s",MBagLocations[Rand][loc]);
timer_mb_1=SetTimer("moneybag1", 60*8000, false);
iseventstarted = true;
}
return 1;
}
I want this cmd moneybag should be apply in gamehour 5. How can i set it on game hour 5
Re: Game time -
Youssef221 - 24.06.2015
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.
Re: Game time -
nezo2001 - 24.06.2015
Try this
In your command:
PHP код:
for(new i = 0;i < MAX_PLAYERS;i++)
{
new hour, minutes;
if(GetPlayerTime(i, hour, minutes) == //The time you want)
{
I'm not sure but try
Re: Game time -
sscarface - 24.06.2015
I have already time but i want to know how can i set moneybag on gamehour 5.?
Re: Game time -
Youssef221 - 24.06.2015
If your time system uses a timer, show me the functions of this timer..
Re: Game time -
Banana_Ghost - 24.06.2015
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;
}
Re: Game time -
sscarface - 24.06.2015
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(1550, 2,xx,yy,zz, -1, -1, -1, 1000.0);
SendClientMessageToAll(COLOR_CYAN,"The Money Bag has started.");
format(town,128, "The money bag is nearest to %s",MBagLocations[Rand][area]);
format(location, 128, "The money bag is in %s",MBagLocations[Rand][loc]);
timer_mb_1=SetTimer("moneybag1", 60*8000, false);
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(string, sizeof(string), "%s",WeekDays[GameDay]);
TextDrawSetString(DaysOfWeek, string);
if (GameHour < 10)
format(string, sizeof(string), "0%d",GameHour);
else
format(string, sizeof(string), "%d",GameHour);
if (GameMinute < 10)
format(string, sizeof(string), "%s:0%d",string,GameMinute);
else
format(string, sizeof(string), "%s:%d",string,GameMinute);
TextDrawSetString(Clock, string);
if (GameHour < 10)
format(string, sizeof(string), "%s, 0%d",WeekDays[GameDay],GameHour);
else
format(string, sizeof(string), "%s, %d",WeekDays[GameDay],GameHour);
if (GameMinute < 10)
format(string, sizeof(string), "%s:0%d",string,GameMinute);
else
format(string, sizeof(string), "%s:%d",string,GameMinute);
if (GameMinute == 0)
{
format(string, sizeof(string), "%s",string);
//printf(string);
format(string2, sizeof(string2), "worldtime %s",string);
SendRconCommand(string2);
format(string, sizeof(string), "{FFFFFF}Game Time: {BDBDBD}%s",string);
SendClientMessageToAll(ROJO, string);
}
}///clock ends
Re: Game time -
Banana_Ghost - 24.06.2015
you didn't say that but eh,
just add something under your timer like:
PHP код:
if(GameHour == 5 && GameMinute == 0){ //Continue your code below.
Re: Game time -
STONEGOLD - 24.06.2015
sdasadd