Exports
Envi-Trap-Phone Exports Documentation
Client Exports
Phone Status
Get the player's currently active phone ID:
local phoneId = exports['envi-trap-phone']:GetActivePhone()
Drug Sales Status
Check various sale states:
local isSelling = exports['envi-trap-phone']:isCornerSelling()
local isDropoffs = exports['envi-trap-phone']:isDoingDropOffs()
local isBusy = exports['envi-trap-phone']:isBusy()
Print the states:
print(isSelling, isDropoffs, isBusy)
Phone Communication
Send message from active phone:
exports['envi-trap-phone']:SendMessage("Meet me at the usual spot", "UNKNOWN") -- sender is optional
Contact Management
Add contact to active phone:
exports['envi-trap-phone']:AddContact({
name = "Contact Name",
number = "5551234",
special = "regular", -- optional
gang = nil -- optional
})
Force the player to level up and meet a new contact:
exports['envi-trap-phone']:MeetNewContact()
Ped Relationships
Update and check ped relationships:
local relationship = exports['envi-trap-phone']:GetPedRelationship(pedModel, faceValue)
exports['envi-trap-phone']:UpdatePedRelationship(pedModel, faceValue, amount)
Server Exports
Phone System
Send messages and manage contacts:
exports['envi-trap-phone']:SendMessageToPhone('5551234', '55543545', "Package ready")
Add contact to phone:
exports['envi-trap-phone']:AddContactToPhone('5551234', {
name = "Big Mike",
number = "55543545",
special = "dealer",
gang = "grove" -- optional
})
Get contact information:
contactData is a table of information
contactType is the type of contact such as "plug", "item_seller" or "regular"
local contactData, contactType = exports['envi-trap-phone']:GetContact(phoneId, contactNumber)
Get all contacts for a phone:
contacts is a table of all contacts
local contacts = exports['envi-trap-phone']:GetAllContacts(phoneId)
Verify phone ownership:
local isOwner = exports['envi-trap-phone']:VerifyPhoneOwnership(source, phoneId)
XP System
Add XP to weed:
exports['envi-trap-phone']:AddXP(source, phoneId, 'weed', 100)
Remove XP from weed:
exports['envi-trap-phone']:RemoveXP(source, phoneId, 'weed', 50)
Example of getting phone ID and adding XP:
local phoneId = exports['envi-trap-phone']:GetActivePhone()
exports['envi-trap-phone']:AddXP(source, phoneId, 'weed', 100)
Gang Reputation System
Increase your reputation with Ballas (Lowers the rank by 100 - Lower Rank = Higher Reputation):
exports['envi-trap-phone']:IncreaseGangRep(playerId, 'Ballas', 100)
Decrease your reputation with Ballas (Increases the rank by 50 - Lower Rank = Higher Reputation):
exports['envi-trap-phone']:DecreaseGangRep(playerId, 'Ballas', 50)
Job-Based Gang Reputation System
Increase job gang reputation:
exports['envi-trap-phone']:IncreaseJobGangRep(source, 'Ballas', 100, 'police')
Decrease job gang reputation:
exports['envi-trap-phone']:DecreaseJobGangRep(source, 'Ballas', 50, 'police')
Export Tables
Client Exports Guide
Phone Functions
GetActivePhone
none
string/nil
Returns current active phone ID
SendMessage
message:string, sender:string?
boolean
Send message from active phone
AddContact
contactData:table
boolean
Add contact to active phone
MeetNewContact
none
boolean
Generate new contact meeting
Sale Status
isCornerSelling
none
boolean
Check if player is corner selling
isDoingDropOffs
none
boolean
Check if player is doing dropoffs
isBusy
none
boolean
Check if player is in active sale
Ped Relationships
UpdatePedRelationship
model:hash, face:number, amount:number
boolean
Update ped relationship
GetPedRelationship
model:hash, face:number
number
Get current relationship value
Job Gang Relationships
LoadGangData
none
nil
Load appropriate gang data
Server Exports Guide
Phone System
SendMessageToPhone
from:string, to:string, content:string
boolean
Send message between phones
AddContactToPhone
phoneId:string, contactData:table
boolean
Add contact to phone
GetContact
phoneId:string, contactNumber:string
contact:table, type:string
Get specific contact
GetAllContacts
phoneId:string
contacts:table
Get all contacts for phone
VerifyPhoneOwnership
source:number, phoneId:string
boolean
Check phone ownership
XP System
AddXP
source:number, phoneId:string, drugKey:string, amount:number
boolean
Add drug XP
RemoveXP
source:number, phoneId:string, drugKey:string, amount:number
boolean
Remove drug XP
Personal Gang Reputation
IncreaseGangRep
source:number, gangName:string, amount:number
boolean
Increase gang reputation
DecreaseGangRep
source:number, gangName:string, amount:number
boolean
Decrease gang reputation
Job-Based Gang Reputation
IncreaseJobGangRep
source:number, gangName:string, amount:number, jobName:string
boolean
Increase job gang reputation
DecreaseJobGangRep
source:number, gangName:string, amount:number, jobName:string
boolean
Decrease job gang reputation
Usage Examples
Basic Phone Management
-- Client side - Check if player is selling and get phone
if exports['envi-trap-phone']:isCornerSelling() then
local phoneId = exports['envi-trap-phone']:GetActivePhone()
if phoneId then
exports['envi-trap-phone']:SendMessage("Currently selling drugs", "System")
end
end
Contact Management
-- Server side - Add a dealer contact to a phone
local success = exports['envi-trap-phone']:AddContactToPhone('5551234', {
name = "Big Mike",
number = "5559876",
special = "dealer",
gang = "grove"
})
-- Server side - Get contact information
local contact, contactType = exports['envi-trap-phone']:GetContact('5551234', '5559876')
if contact then
print('Contact Name:', contact.name)
print('Contact Type:', contactType)
end
Gang Reputation Management
-- Server side - Increase personal gang reputation
exports['envi-trap-phone']:IncreaseGangRep(source, 'Ballas', 100)
-- Server side - Increase job-based gang reputation for police
exports['envi-trap-phone']:IncreaseJobGangRep(source, 'Ballas', 100, 'police')
Job-Aware Gang System
-- Client side - Check if using job relationships and update accordingly
if exports['envi-trap-phone']:ShouldUseJobGangRelationships() then
exports['envi-trap-phone']:UpdateJobAwareGangRank('Ballas', 50, function(success)
if success then
print('Job gang rank updated successfully')
end
end)
else
-- Handle personal gang relationships
print('Using personal gang relationships')
end
XP System Integration
-- Server side - Award XP after successful drug sale
local phoneId = exports['envi-trap-phone']:GetActivePhone() -- This would need to be called on client
if phoneId then
local success = exports['envi-trap-phone']:AddXP(source, phoneId, 'weed', 25)
if success then
TriggerClientEvent('chat:addMessage', source, {
args = {'System', 'You gained 25 weed XP!'}
})
end
end
Last updated