Randomize Point Profit
#1

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?
Reply
#2

https://sampwiki.blast.hk/wiki/SetTimer
https://sampwiki.blast.hk/wiki/SetTimerEx
https://sampwiki.blast.hk/wiki/Random
Reply
#3

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
Reply
#4

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.
Reply
#5

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 ?
Reply
#6

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 )
Reply
#7

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.
Reply
#8

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.
Reply
#9

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)