Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
-- On the serverside, inside the buy function of the faction buymenu, put Events:Fire("FactionMenuPurchaseVehicleAlert", player) -- This fires a notice to ALL the modules on that side of the network(Server or client side, in this case server). -- The data being sent is the playerObject. You could easily send a table with lots of data in it. -- In the init of the regular menu put: Events:Subscribe("FactionMenuPurchaseVehicleAlert", self, self.FactionMenuPurchaseVehicleAlert) -- This receives the above mentioned event notice. ONLY a module with this subscription will act on it, though they all will hear it. Just like in normal network communication. function BuyMenu:FactionMenuPurchaseVehicleAlert(player) -- This function is called when the event notice is received. if IsValid(player) then -- Validate that the player obj is still valid. It's possible they lagged out between the communication (even though it's essentially instant). local veh = self.vehicles[player:GetId()] -- Since the player is valid, we now use the playerObject to key into the BuyMenu vehicle table the same way it is done in the other areas of the BuyMenu, with Player ID. if IsValid(veh) then -- We check to see if the vehicle is valid. -- If there is no vehicle purchased yet, veh should be nil. -- If a vehicle was purchased but is no longer valid, IsValid returns false and this check fails. -- If a vehicle was previously purchased and is still valid, veh will be that vehicleObject. veh:Remove() -- We now remove the vehicle. end end end
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)