This allows you to give a user a warning on the F10 system implementation.
Params:
target_id - The user's id to warn in the database.
adminName - The warning admin
warningReason - The reason for the F10 warning.
vRP.isWhitelisted(user_id, cbr)
This allows us to check if the user is whitelisted from the server and will provide a callback return of true or false if a database entry is found.
Params:
user_id - The user's id in the database.
Cbr - callback function to return the value.
vRP.setWhitelisted(user_id,whitelisted)
This allows us to set if the player is whitelisted this will only work if whitelisting is enabled in base.lua cfg
Params:
user_id - The user's id in the database.
whitelisted - The value true or false if to set the whitelist.
vRP.getLastLogin(user_id, cbr)
Get the last login of the player from the database.
Params:
user_id - The user's id in the database.
Cbr - callback function to return the value.
vRP.fetchBanReasonTime(user_id,cbr)
Fetches the ban reason, bantime, and banning admin.
Params:
user_id - The user's id in the database.
Cbr - callback function to return the values.
vRP.setUData(user_id,key,value)
Sets the user data table with the specified key this is usually used to set inventory data and vehicle boot data.
Params:
user_id - The user's id in the database.
key - The key that is used to select the database entry for that specific data.
value - Is the value to save to that entry usually in a JSON format.
vRP.getUData(user_id,key,cbr)
This fetches the user data with the specified key this is used to fetch the value.
Params:
user_id - The user's id in the database.
key - The key that is used to select the database entry for that specific data.
cbr - The callback to return the data.
vRP.setSData(key,value)
Params:
key - The database entry key to select for that specific data.
value - To set for the database entry value.
vRP.getSData(key, cbr)
Params:
key - The database entry key to select for that specific data.
cbr - The callback to return the data.
vRP.getUserDataTable(user_id)
Fetches the user data table entry in the database vrpuser_data entry.
Params:
user_id - The user's id in the database.
Will return the user table.
vRP.getUserTmpTable(user_id)
Returns the user temp table which will reset when the server restarts or vRP resource restarts.
Params:
user_id - The user's id in the database.
Will return the temp table.
vRP.isConnected(user_id)
Returns if the user is connected to the server or not.
Params:
user_id - The user's id in the database.
Will return true or false whether the user is on the server.
vRP.isFirstSpawn(user_id)
Returns whether this is the first time the user is connecting to the server.
Params:
user_id - The user's id in the database.
vRP.getUserId(source)
Fetches the userid from the source of the player.
Params:
source - (Player's tempid)
vRP.getUsers()
Returns the users on the table with a key and index
Example:
vRP.getUserSource(user_id)
Returns the source of the player from the user_id
Params:
user_id - The user's id in the database.
vRP.IdentifierBanCheck(source,user_id,cb)
Checks if this players identifiers are banned.
Params:
source - The source of the player (temp id as some may call it)
user_id - The user's id in the database.
cb - The callback function to return true or false whether they are banned + the userid this is linked too.
vRP.BanIdentifiers(user_id, value)
This will ban all the users identifiers in the database for the specified user ID.
Params:
user_id - The user's id in the database.
value - true or false whether to be banned or not.
vRP.setBanned(user_id,banned,time,reason, admin)
This will set the specified user banned and will automatically ban identifiers and tokens.
Params:
user_id - The user's id in the database.
banned - Sets whether the user is banned or not.
Time - this time should be in unix time (s)
Reason - the reason for the ban to be displayed.
Admin - The admin to show up on the banned by: message.
This can be used to unban players too! Example below
vRP.ban(adminsource,permid,time,reason)
This will ban the user. This is to be used on ban functions.
Params:
adminsource - The banning admin.
permid - The userid that is getting banned.
Time - This is the time in hours it will convert to unix for you.
Reason - the reason for the ban in a string format.
This can be used even if the player is offline!
This function will automatically token and identifier ban.
vRP.banConsole(permid,time,reason)
This function is new to Dunko vRP and will allow you to console ban users without requiring an admin source.
Params:
permid - The user id of the user being banned.
time - The time in hours this will be converted for you to unix.
reason - Again the reason for the ban.
This can even be used if the player is offline!
vRP.StoreTokens(source, user_id)
This will store all the tokens from the specified source and assign them to that userid.
Params:
source - The player's tempid.
userid - The player's userid in the database entry.
vRP.CheckTokens(source, user_id)
Checks each of the sources tokens to see if the player is banned by any of his tokens and then will return that if the user is banned and the users user_id.
Params:
source - The player's tempid.
userid - The player's userid in the database.
The player must be online
vRP.BanTokens(user_id, banned)
This will ban all the tokens of the player that are registered.
Params:
user_id - The player's userid in the database.
banned - Sets whether the tokens are banned or not.
vRP.kick(source,reason)
This will kick the source and remove them from the server with the specified reason they can reconnect.
Params:
source - The player's tempid.
userid - The player's userid in the database.
Server Survival Functions
vRP.getHunger(user_id)
This will return the number value of hunger for that player.
Params:
userid - The player's userid in the database.
vRP.getThirst(user_id)
This will return the number value of thirst for that player.
Params:
userid - The player's userid in the database.
vRP.setHunger(user_id, value)
This will set value of hunger for the player.
Params:
userid - The player's userid in the database.
value - The amount of hunger eg: 0-100
vRP.setThirst(user_id, value)
This will set value of thirst for the player.
Params:
userid - The player's userid in the database.
value - The amount of thirst eg: 0-100
vRP.varyHunger(user_id, variation)
This will vary the hunger which means it will add the variation on top of their current hunger.
Params:
userid - The player's userid in the database
variation - The amount to add onto their hunger.
vRP.varyThirst(user_id, variation)
This will vary the thirst which means it will add the variation on top of their current thirst.
Params:
userid - The player's userid in the database
variation - The amount to add onto their thirst.
Server Police Functions
vRP.insertPoliceRecord(user_id, line)
This will insert a new police record line, however this function is likely to be deprecated in future.
Params:
userid - The player's userid in the database
line - The string to add.
vRP.openPolicePC(source)
Will open the police pc
Params:
source - The user's tempid persay as some would call it.
vRP.openPoliceMenu(source)
Will open the police menu
Params:
source - The user's tempid persay as some would call it.
vRP.getUserWantedLevel(user_id)
This will return the wanted level of the player, again this likely won't be required by most of you.
Params:
user_id - The user's id in the database.
Server Money Functions
vRP.getMoney(user_id)
This will get the player's wallet amount.
Params:
user_id - The user's id in the database.
vRP.setMoney(user_id,value)
This will set the user's wallet to the specified amount
Params:
user_id - The user's id in the database.
value - The amount of money to set.
vRP.tryPayment(user_id,amount)
This reducts money from the user's wallet. It will return a true or false value if it successfully took the money from the user.
Params:
user_id - The user's id in the database.
amount - The amount of money to take.
vRP.tryBankPayment(user_id, amount)
This reducts money from the user's bank
Params:
user_id - The user's id in the database.
amount - The amount of money to take.
The example above will work in the same way this however just need to change vRP.tryPayment to vRP.tryBankPayment
vRP.giveMoney(user_id,amount)
This will give the user money which will add to his current amount of money this money will be stored within his wallet.
Params:
user_id - The user's id in the database.
amount - The amount of money to take.
vRP.getBankMoney(user_id)
This function will fetch the user's money that they have in their bank!
Params:
user_id - The user's id in the database.
Returns the amount of money in their bank.
vRP.setBankMoney(user_id,value)
This will set the bank money for the user it will not add or remove it will set it to that exact value.
Params:
user_id - The user's id in the database.
Value - the amount to set it too!
vRP.giveBankMoney(user_id,amount)
This will add to the current bank balance of the user.
Params:
user_id - The user's id in the database.
amount - The amount to add to their bank balance.
vRP.tryWithdraw(user_id,amount)
This value checks if the user has the specified amount to withdraw and if it does it will withdraw that to their wallet.
Params:
user_id - The user's id in the database.
amount - The amount to add to their bank balance.
Returns true or false if successful or not.
vRP.tryDeposit(user_id,amount)
This value checks if the user has the specified amount to deposit and if it does it will deposit that to their bank.
Params:
user_id - The user's id in the database.
amount - The amount to add to their bank balance.
Returns true or false if successful or not.
vRP.tryFullPayment(user_id,amount)
This will try to take money from both the bank and wallet. It will return true or false whether successful or not.
This sets a set of coords as an "area" when a user enters this vRP will update and send a callback on entering and leaving. This function will likely be deprecated soon as it's rarely used.
Params:
source - The tempid of the user.
name - The name of the area
x - X Coordinate
y - Y Coordinate
z - Z Coordinate
Radius - The radius from center of those coords.
Height - How height this area is applied for.
cb_enter - Function to handle entering in area will return source and name.
cb_leave - Function to handle entering in area will return source and name.
This is set for that user source only.
vRP.removeArea(source,name)
This is self-explanatory and just removes the area for the player.
Params:
source - Users TempID
name - Name of the area.
This is set for that user source only.
Server Inventory Functions
vRP.computeItemName(item,args)
This will return the item name for the specified item.
Params:
item - The item name.
args - The path to the item in the vRP.Items table
Example:
vRP.computeItemWeight(item,args)
This will return the item weight for the specified item.
Params:
item - The item name.
args - The path to the item in the vRP.Items table
Example:
vRP.computeItemDescription(item,args)
This will return the item description for the specified item.
Params:
item - The item name.
args - The path to the item in the vRP.Items table
Example:
vRP.computeItemChoices(item,args)
This will return the choices for the item which can then be compiled into a use list.
Params:
item - The item name.
args - Path to item in vRP.Items Table
This works the same as the above examples do also.
Example:
vRP.parseItem(idname)
Splits the string based on the | seperator set by vRP.
Params:
idname - The idname of the item set in the cfg/items configuration.
vRP.getItemDefinition(idname)
Fetches you the name, description, weight of the item.
Params:
idname - The idname of the item set in the cfg/items configuration.
Returns name, description, weight.
vRP.getItemName(idname)
Returns the item name from the idname
Params:
idname - The idname of the item set in the cfg/items configuration.
vRP.getItemDescription(idname)
Returns the item description from the idname.
Params:
idname - The idname of the item set in the cfg/items configuration.
vRP.getItemChoices(idname)
This will again set the choices out for the inventory.
Params:
idname - The idname of the item set in the cfg/items configuration.
vRP.getItemWeight(idname)
This will fetch the item weight for the specified item.
Params:
idname - The idname of the item set in the cfg/items configuration.
vRP.computeItemsWeight(items)
This will compute all the item weight of all the items in the inventory/chest table format.
This will try to obtain the item specified from the user and returns a true or false value if successful the same as vRP.tryPayment and vRP.tryFullPayment work!
Params:
user_id - The id of the user
idname - The item name
amount - The amount of the item
notify - Whether to give them a notification on the fact they recieved the item.
vRP.getInventoryItemAmount(user_id, idname)
Will return the item amount in the user's inventory.
Params:
user_id - The id of the user.
idname - The item name in the items.lua
vRP.getInventoryWeight(user_id)
Will return the current inventory weight for the user.
service_name - The service required eg: emergency for EMS.
x,y,z - The coordinates of the call.
msg - The msg of what the call will be.
Example:
vRP.sendSMS(user_id, phone, msg, cbr)
Used to notify a user of an SMS message they have recieved from another player.
Params:
user_id - The user's id.
phone - The phone number of the user the message has been sent to.
msg - The message to be sent.
cbr - The callback to return whether it was successfully sent.
vRP.sendSMSPos(user_id, phone, x,y,z, cbr)
Sends their position from a user to another user's phone number.
Params:
user_id - The user's id.
phone - The phone number of the user the message has been sent to.
x,y,z - The coordinates of the position.
cbr - The callback for the SMS to see if it has been sent successfully returns true if so.
vRP.getPhoneDirectory(user_id)
Returns the phone directory for the specified user.
Params:
user_id - The user's id.
vRP.getPhoneDirectoryName(user_id, phone)
Returns the directory name for that specified phone number.
Params:
user_id - The user's id.
vRP.getPhoneSMS(user_id)
Fetches the temp SMS table.
Params:
user_id - The user's id.
Server Admin Menu Functions
vRP.openAdminMenu(source)
Opens the admin menu for the specified source.
Params:
source - The user's tempid persay.
Client Basic Garage Functions
tvRP.spawnGarageVehicle(vtype,name,pos)
This will spawn a garage vehicle for that user which will register if you have the one vehicle out at a time only option enabled this will not allow them to get the vehicle out if they already have one out.
Params:
vtype - This is the vehicle type eg: "Car" etc.
name - This is the vehicle spawncode.
pos - The coors to spawn the vehicle at.
tvRP.despawnGarageVehicle(vtype,max_range)
This will despawn the garage vehicle by the vehicle type.
Params:
vtype - This is the vehicle type eg: "Car" etc.
max_range - This is the max range to despawn all vehicles within that radius from the player.
Client Map Functions
tvRP.addBlip(x,y,z,idtype,idcolor,text)
Adds a blip to the map in the specified coords with the specified id and color.
local users = vRP.getUsers()
for userid,source in pairs(users) do
print(userid, source)
end
vRP.setbanned(user_id, false)
vRP.ban(adminsource, 1, 24, "Being a JamesUK!!") -- This will ban the player for 24 hours (1 day)
vRP.banConsole(1, 24,"Stop being a JamesUK!!") -- This again will console ban the player for 24 hours.
if vRP.tryPayment(1, 2000) then
print('Money taken!! Award Item')
else
print('Darn money not taken not enough funds bro.')
end
if vRP.tryFullPayment(1, 2000) then
print('Money taken!! Award Item')
else
print('Darn money not taken not enough funds bro.')
end
local args = vRP.parseItem(idname)
local item = vRP.items[args[1]] -- Args[1] is the name of the item
if item ~= nil then
return vRP.computeItemName(item,args), vRP.computeItemDescription(item,args), vRP.computeItemWeight(item,args)
end
local args = vRP.parseItem(idname)
local item = vRP.items[args[1]] -- Args[1] is the name of the item
if item ~= nil then
return vRP.computeItemName(item,args), vRP.computeItemDescription(item,args), vRP.computeItemWeight(item,args)
end
local args = vRP.parseItem(idname)
local item = vRP.items[args[1]] -- Args[1] is the name of the item
if item ~= nil then
return vRP.computeItemName(item,args), vRP.computeItemDescription(item,args), vRP.computeItemWeight(item,args)
end
local args = vRP.parseItem(idname)
local item = vRP.items[args[1]]
local choices = {}
if item ~= nil then
-- compute choices
local cchoices = vRP.computeItemChoices(item, args)
if cchoices then -- copy computed choices
for k, v in pairs(cchoices) do
choices[k] = v
end
end
-- add give/trash choices
choices[lang.inventory.give.title()] = {function(player, choice)
ch_give(idname, player, choice)
end, lang.inventory.give.description()}
choices[lang.inventory.trash.title()] = {function(player, choice)
ch_trash(idname, player, choice)
end, lang.inventory.trash.description()}
end
local name, description, weight = vRP.getItemDefinition("seeds")
print(name, description, weight)
local data = vRP.getUserDataTable(user_id)
local weight = vRP.computeItemsWeight(data.inventory)
if vRP.tryGetInventoryItem(user_id,"weed",1) then
print('he has the item!')
else
print('pog you do not sad.')
end
local atm_menu = {
name = "ATM",
css = {
top = "75px",
header_color = "rgba(0,255,125,0.75)"
}
}
vRP.openMenu(source, atm_menu)
vRP.prompt(player,"User id:","",function(player,user_id)
if user_id then
print('His userid is: ' .. user_id)
end
end)
vRP.request(v,"Take admin ticket", 60, function(v,ok)
if ok then
print('ticket accepted teleporting now!')
end
end)
vRP.registerMenuBuilder("main", function(add, data)
local user_id = vRP.getUserId(data.player)
if user_id ~= nil then
local choices = {}
if vRP.hasPermission(user_id, "emergency.revive") then
choices[lang.emergency.menu.revive.title()] = choice_revive
end
add(choices)
end
end)