warxander / los-santos-v

FiveM PvPvE Freeroam game mode
https://forum.cfx.re/t/free-standalone-los-santos-v-pvpve-freeroam/58237
55 stars 20 forks source link

Add money trigger/function. #11

Closed omershevach closed 4 years ago

omershevach commented 4 years ago

Hello i am making a script that gives you cash if you are in a location. my problem is that i dont know what trigger/function gives you money in that gamemode.

i hope to get an answer. Thanks.

warxander commented 4 years ago

Hi,

The general idea is to send server event with player position if he is in the area, validate data on server and use Db.UpdateCash to give him money.

omershevach commented 4 years ago

i already did the cheak of the player location, i just need the trigger to give him money. i have tried this: (is server side)

    TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'inform', text = 'Test!', length = 2500, style = { ['background-color'] = '#ffffff', ['color'] = '#000000' } })
    Citizen.Wait(1000)
    local player = source

    Db.UpdateCash(player, 100)

and i does not work and not giving an error.

omershevach commented 4 years ago

image im getting the notification but the money stay 0 image

omershevach commented 4 years ago

/server.lua:7: attempt to index a nil value (global 'Db')

warxander commented 4 years ago

You can't access lsv-main files from other resources. Los Santos V is a complete game mode, not framework, and if you want to change smth - modify it directly.