Jump to content

example pls


Best-Killer

Recommended Posts

Atms ---

Store money in table, assigned to players serial, for deposits, add money to the table,take player the money if he has sufficient amount and for withdraws, take money from table, give it to player.

----------

Lottery --

Store people who bought tickets in a table, use same table just add the player to it if he buys a ticket, make a timer repeat every said minutes, and make it randomly select a name, with a random amount of money, or static amount.

Link to comment
local Peds = {  
-- id skin , x,y,z , Rotation 
{14,1536.6, -1663.82, 13.55,260}, 
{14,1536.6, -1663.82, 13.55,260}, 
} 
  
  
for _,v in ipairs ( Peds ) do  
createPed(v[1],v[2],v[3],v[4],v[5]) 
end 
  

this is you want ?

thanks but

local Peds = { 
-- id skin , x,y,z , Rotation 
{14,1536.6, -1663.82, 13.55,260}, 
{14,1536.6, -1663.82, 13.55,260}, 
} 
for _,v in ipairs ( Peds ) do 
createPed(v[1],v[2],v[3],v[4],v[5]) 
end 
  
  
  
function onPedClick(button, state, absX, absY, wx, wy, wz, element) 
    if (element and getElementType(element) == "ped" and state=="down") then 
        local x, y, z = getElementPosition(localPlayer) 
        if (element == Peds) then 
            if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then 
                guiSetVisible(GUIEditor.window[1], true) 
                showCursor (true) 
           end 
        end 
    end 
end 
addEventHandler("onClientClick", root, onPedClick) 
when i click on the peds gui not showing 

Link to comment

test this

local Peds = { 
-- id skin , x,y,z , Rotation 
{14,1536.6, -1663.82, 13.55,260}, 
{14,1536.6, -1663.82, 13.55,260}, 
} 
for _,v in ipairs ( Peds ) do 
Ped = createPed(v[1],v[2],v[3],v[4],v[5]) 
end 
  
  
  
function onPedClick(button, state, absX, absY, wx, wy, wz, element) 
    if (element and getElementType(element) == "ped" and state=="down") then 
        local x, y, z = getElementPosition(localPlayer) 
        if (element == Ped) then 
            if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then 
                guiSetVisible(GUIEditor.window[1], true) 
                showCursor (true) 
           end 
        end 
    end 
end 
addEventHandler("onClientClick", root, onPedClick) 

Link to comment

thanks work :)

bro bro i have drug dev script and now when i add lottery peds when i click on ped when i'm not as criminal the drug dev outputchatbox showing pls tell me the problem :/

code :

local ped = createPed(29, 1602.55, -1489.33, 13.59,180) 
setElementFrozen ( ped, true ) 
  
function showwindowdr () 
local visibe = guiGetVisible(GUIEditor.window[1]) 
if visibe == false then 
    showCursor(true)       
    guiSetVisible(GUIEditor.window[1],true) 
end 
end 
addEvent( "showwindowdr", true ) 
addEventHandler ( "showwindowdr", getRootElement(), showwindowdr) 
  
function onPedClick(button, state, absX, absY, wx, wy, wz, element) 
    if (element and getElementType(element) == "ped" and state=="down") then 
    if getTeamName(getPlayerTeam(getLocalPlayer())) ~= "Criminals" then outputChatBox("Drug Delivery: You must be criminal.",255,0,0) return end 
        local x, y, z = getElementPosition(localPlayer) 
        if (element == ped) then 
            if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then 
                guiSetVisible(GUIEditor.window[1], true) 
                showCursor (true) 
           end 
        end 
    end 
end 
addEventHandler("onClientClick", root, onPedClick) 

Link to comment

you are welcome

test this

function onPedClick(button, state, absX, absY, wx, wy, wz, element) 
    if (element and getElementType(element) == "ped" and state=="down") then 
    if ( getPlayerTeam ( localPlayer ) and getTeamName ( getPlayerTeam ( localPlayer ) ) == getTeamFromName('Criminals') ) then  
    return outputChatBox("Drug Delivery: You must be criminal.",255,0,0) end 
        local x, y, z = getElementPosition(localPlayer) 
        if (element == ped) then 
            if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then 
                guiSetVisible(GUIEditor.window[1], true) 
                showCursor (true) 
           end 
        end 
    end 
end 
addEventHandler("onClientClick", root, onPedClick) 
  

Edited by Guest
Link to comment
you are welcome

test this

function onPedClick(button, state, absX, absY, wx, wy, wz, element) 
    if (element and getElementType(element) == "ped" and state=="down") then 
    if ( getPlayerTeam ( localPlayer ) and getTeamName ( getPlayerTeam ( localPlayer ) ) ~= getTeamFromName('Criminals') ) then  
    return outputChatBox("Drug Delivery: You must be criminal.",255,0,0) end 
        local x, y, z = getElementPosition(localPlayer) 
        if (element == ped) then 
            if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then 
                guiSetVisible(GUIEditor.window[1], true) 
                showCursor (true) 
           end 
        end 
    end 
end 
addEventHandler("onClientClick", root, onPedClick) 
  

same problem

Link to comment

i did other one pls check it :/ gui not showing

local locs = { 
    { 1072.6, -1385.51, 13.88, 139 } 
} 
  
local peds = { } 
for i, v in ipairs ( locs ) do 
    local x, y, z, rot = unpack ( v ) 
    peds[i] = createPed ( 57, x, y, z, rot ) 
    exports.SAEGJobs:create3DText ( "Lottery", { x, y, z }, { 255, 255, 0 }, nil, { } ) 
    setElementFrozen ( peds[i], true ) 
    addEventHandler ( "onClientPedDamage", peds[i], cancelEvent ) 
end 
  
  
function onPedClick(button, state, absX, absY, wx, wy, wz, element) 
    if (element and getElementType(element) == "ped" and state=="down") then 
        local x, y, z = getElementPosition(localPlayer) 
        if (element == peds[i]) then 
            if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then 
                guiSetVisible(GUIEditor.window[1], true) 
                showCursor (true) 
           end 
        end 
    end 
end 
addEventHandler("onClientClick", root, onPedClick) 

Link to comment
  
local locs = { 
    { 1072.6, -1385.51, 13.88, 139 } 
} 
  
local peds = { } 
for i, v in ipairs ( locs ) do 
    local x, y, z, rot = unpack ( v ) 
    peds[i] = createPed ( 57, x, y, z, rot ) 
    exports.SAEGJobs:create3DText ( "Lottery", { x, y, z }, { 255, 255, 0 }, nil, { } ) 
    setElementFrozen ( peds[i], true ) 
    addEventHandler ( "onClientPedDamage", peds[i], cancelEvent ) 
end 
  
  
function onPedClick(button, state, absX, absY, wx, wy, wz, element) 
    if (element and getElementType(element) == "ped" and state=="down") then 
        local x, y, z = getElementPosition(localPlayer) 
        wx, wy, wz = getElementPosition(element) 
        if (element == peds[i]) then 
            if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz) < 5 then 
                guiSetVisible(GUIEditor.window[1], true) 
                showCursor (true) 
           end 
        end 
    end 
end 
addEventHandler("onClientClick", root, onPedClick) 
  

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...