Robbing system checkpoints
#7

Quote:
Originally Posted by NaS
Посмотреть сообщение
Create an Array (with an enumerator) which holds each Shop's Enter/Exit/Robbery Checkpoint Coordinates and the Interior ID (best would be also adding an angle to the enter/exit coords for the teleport).
Mabye also a Name for the shop, a Value and Coordinates for the Actor (if you want to add that).

You should also create an Array for each Player that saves the last time a player was teleported into/out of a Robbery Store (to prevent an endless loop of teleporting).

Also add a variable to the enumerator which holds the timestamp of the last robbery (use gettime(), not GetTickCount() because you don't need milliseconds, and GetTickCount() is not safe for longer durations).
I'd not do it like FuNkY said, it's totally unneccessary to use a timer here. Also this method is accurate (timers are not, by default).

In GameModeInit you then just have to create all the Checkpoints and fill the timestamp with the current time - 60 (assuming 60 seconds is the minimum time between 2 robberies).

Then in OnPlayerEnterDynamicCP you check if the entered checkpoint is one of the Shop CPs and which one.

If it's the Enter CP, check the time of the player's last teleport to prevent an endless loop of teleports. If the last teleport is longer than (eg) 5 seconds ago, teleport the player to the Exit CP (inside the Shop) and set the variable mentioned above to the current time (gettime()). If you wouldn't do that, the player would get teleported back/forth endlessly, cause he enters the Exit CP after the teleport.

(Same for the Exit CP, just the other way around).

Then handle the Robbery CP accordingly, not sure how exactly you want to do that. Using gettime() and a simple timer you can repeatedly check if the player is still aiming the Actor and for how long. If you just want to make a /rob command or something, do that instead.

To add Stores you can now just /save 3 coordinates and paste them into your mode.

Later you can also make them save to a file and load, or whatever you prefer to save data, so you could create them ingame without having to GMX/copy around coords at all.

It would also be a good idea to set the Player's Virtual World to a unique number for each Shop (eg. 2000 + Shop ID). That way you can re-use interiors for different Shops.
I got a feeling that this should be the way to go, but I don't really understand you. Would you mind giving me a small piece of code for an example?
Reply


Messages In This Thread
Robbing system checkpoints - by Deroxi - 03.12.2017, 15:40
Re: Robbing system checkpoints - by AlexMSK - 03.12.2017, 16:10
Re: Robbing system checkpoints - by Deroxi - 03.12.2017, 16:29
Re: Robbing system checkpoints - by FuNkYTheGreat - 03.12.2017, 16:45
Re: Robbing system checkpoints - by Deroxi - 03.12.2017, 20:00
Re: Robbing system checkpoints - by NaS - 04.12.2017, 00:14
Re: Robbing system checkpoints - by Deroxi - 04.12.2017, 17:03
Re: Robbing system checkpoints - by jasperschellekens - 04.12.2017, 20:37
Re: Robbing system checkpoints - by Deroxi - 05.12.2017, 09:50
Re: Robbing system checkpoints - by Sjn - 05.12.2017, 11:13

Forum Jump:


Users browsing this thread: 1 Guest(s)