Randomize Point Profit -
NeXoR - 30.03.2016
Hey guys, I'm working on a roleplay gamemode based on Union Gaming
I decided to change the family point profit,
Currently: It's changing upto whenever a player buys something from the point
Ex: Cocaine Depot Profit will increase whenever someone buys cocaine
So I wanted to ask, how can I randomize it to add a random amount every x minutes?
Re: Randomize Point Profit -
Threshold - 30.03.2016
https://sampwiki.blast.hk/wiki/SetTimer
https://sampwiki.blast.hk/wiki/SetTimerEx
https://sampwiki.blast.hk/wiki/Random
Re: Randomize Point Profit -
NeXoR - 30.03.2016
Quote:
Originally Posted by Threshold
|
Okay, last question and I guess I'll do it myself
Shall I do it on LoadPoints stock (Loads all the server points on the OnGameModeInit)
OnGameModeInit itself
or something else
Re: Randomize Point Profit -
fuckingcruse - 30.03.2016
Simple. If you are going to do this thing by a cmd set the timer unfer that command. Or if you want it to start when the player enters server then do it under onplayerconnect. ( ongamemodeinit is when you run the exr file ).
So onplayerconnect is good.
Re: Randomize Point Profit -
NeXoR - 30.03.2016
Quote:
Originally Posted by fuckingcruse
Simple. If you are going to do this thing by a cmd set the timer unfer that command. Or if you want it to start when the player enters server then do it under onplayerconnect. ( ongamemodeinit is when you run the exr file ).
So onplayerconnect is good.
|
Well, I want to do this whenever the point is captured
I mean, If Point 0 is captured (Even if there are 0 players connected), It will start adding random money every X minutes (10 for exmaple), And whenever the Point is not captured anymore (The point profit is set to 0 automatically) I want to stop the Timer looping
in which public should I do this ?
Do I have to forward a new one ?
Re: Randomize Point Profit -
fuckingcruse - 30.03.2016
Onplayerconnect.
Код:
if( ) //The codes if the player is at captured point
{
SET TIMER HERE example the timer name is captured
}
if() //not captured
{
set value here by a new enum let it be 1
}
In the timer captured :
If() the new enum value is 1
{
killtimer
}
I was clear I guess. I am on phone.
//edit : you may even put the codes under onplayerspawn ( more efficient is suggest this )
Re: Randomize Point Profit -
NeXoR - 30.03.2016
Quote:
Originally Posted by fuckingcruse
Onplayerconnect.
Код:
if( ) //The codes if the player is at captured point
{
SET TIMER HERE example the timer name is captured
}
if() //not captured
{
set value here by a new enum let it be 1
}
In the timer captured :
If() the new enum value is 1
{
killtimer
}
I was clear I guess. I am on phone.
//edit : you may even put the codes under onplayerspawn ( more efficient is suggest this )
|
If for example I do this per 10 minutes
Shouldn't I do it on OnGameModeInit and loop the timer ?
So even tho when the point is captured it will start adding money only when the next check is executed I don't really have a problem with that.
Re: Randomize Point Profit -
fuckingcruse - 30.03.2016
Ok you may decide it by reading the differences :
OnGameModeInit - when you start the exe file
OnPlayerConnect - When you just open the game. Not spawned
OnPlayerSpawn - When you set your foot on the game.
You may try it with anyone. If something goes wrong then try my trick it will definately works.
Re: Randomize Point Profit -
-CaRRoT - 30.03.2016
Quote:
Originally Posted by NeXoR
If for example I do this per 10 minutes
Shouldn't I do it on OnGameModeInit and loop the timer ?
So even tho when the point is captured it will start adding money only when the next check is executed I don't really have a problem with that.
|
Yes, the timer should be placed under OnGameModeInIt and keep on looping it, the guy above me is clueless.