saving timer -
astanalol - 22.03.2017
hello guys
i need some help
i made robable timer
i want saving it with y_ini
and countdown when he is down the timer from his saving
PHP код:
new Robable=1;
forward RobTimer();
forward RobbingTimer(playerid);
public RobbingTimer(playerid)
{
Robable = 1;
SendClientMessage(playerid,0xFF0000, "Sets the robbing variable to 1 so players can rob");
return 1;
}
SetTimer("RobTimer", 400000, false);
its working good but need to saving the timer in enum and countdown when he is online the timer
Re: saving timer -
astanalol - 23.03.2017
help please
Re: saving timer -
Runn3R - 23.03.2017
Can you repeat that in english?
Re: saving timer -
astanalol - 24.03.2017
Quote:
Originally Posted by Runn3R
Can you repeat that in english?
|
okay
i mean
Saving this timer if player not finished his countdown
PHP код:
SetTimer("RobTimer", 400000, false);
get how much he is have to can use this cmds and saving the time and countdown in his saving when he is online
u know what i mean now!!
Re: saving timer -
Toroi - 24.03.2017
Don't use the timer.
Create another entry in your enum and use the
gettime() + 400 function to save the time plus your desired waiting time (400 in this case) when the player issues the command.
Before the command's functions, make a conditional statement to check if the variable of the player is equal or bigger than the actual
gettime() and let the functions execute if the player complies with the requirements.
For saving it just do the same as other integer variables in your PlayerSave function.
The structure would look like this:
PHP код:
yourcommand
{
check if player variable is NOT over gettime(), then return something;
robbing functions;
set the player variable to = gettime() + 400;
return 1;
}
Re: saving timer -
astanalol - 24.03.2017
Quote:
Originally Posted by Troydere
Don't use the timer.
Create another entry in your enum and use the gettime() + 400 function to save the time plus your desired waiting time (400 in this case) when the player issues the command.
Before the command's functions, make a conditional statement to check if the variable of the player is equal or bigger than the actual gettime() and let the functions execute if the player complies with the requirements.
For saving it just do the same as other integer variables in your PlayerSave function.
The structure would look like this:
PHP код:
yourcommand
{
check if player variable is NOT over gettime(), then return something;
robbing functions;
set the player variable to = gettime() + 400;
return 1;
}
|
what about saving it here ? to saving and load
like this
PHP код:
INI_WriteInt(File,"RobTimer",pRobTimer(playerid));
Re: saving timer -
jasperschellekens - 24.03.2017
Why don't do it like this?
Код:
CMD:rob(playerid, params[])
{
Temp[playerid] = gettime();
if(gettime() - Temp[playerid] < 300)
{
// do things here
}else return SendClientMessage(playerid, -1, "Please wait before doing this again");
}
300 will set it to 300 seconds. The player cant use the command for the next 5 minutes
Edit:
You can save it like this:
Код:
INI_WriteInt(File,"RobTime",Temp[playerid]);
But i doubt that will actually be useful, unless you make it save every second.
It will be useful against re-logging to restore the timer.
Re: saving timer -
ATGOggy - 24.03.2017
PHP код:
new Robable=1, Count[MAX_PLAYERS];
forward RobTimer();
forward RobTimer(playerid);
public RobTimer(playerid)
{
Count[playerid]--;
if(Count[playerid]==0)
{
Robable[playerid]=1;
SendClientMessage(playerid,0xFF0000, "Sets the robbing variable to 1 so players can rob");
}
}
SetTimer("RobTimer", 1000, false);
Count[playerid]=400;
INI_WriteInt(File,"RobTimer",Count[playerid]);
Re: saving timer -
astanalol - 24.03.2017
Quote:
Originally Posted by ATGOggy
PHP код:
new Robable=1, Count[MAX_PLAYERS];
forward RobTimer();
forward RobTimer(playerid);
public RobTimer(playerid)
{
Count[playerid]--;
if(Count[playerid]==0)
{
Robable[playerid]=1;
SendClientMessage(playerid,0xFF0000, "Sets the robbing variable to 1 so players can rob");
}
}
SetTimer("RobTimer", 1000, false);
Count[playerid]=400;
INI_WriteInt(File,"RobTimer",Count[playerid]);
|
there is much error

somone help please!!!
Re: saving timer -
jasperschellekens - 24.03.2017
Quote:
Originally Posted by astanalol
there is much error 
somone help please!!!
|
You really should be more specific.
What is the error?
what is wrong?
We can't help you if we don't know whats going on.