Jump to content

Peds spawn at same position


EmBaby85

Recommended Posts

 

I am creating a script, I have peds in database with different X,Y,Z but now I see all of them spawn at the same position. What's wrong in my code?

[lua]function loadPeds()
    local P = dbPoll ( dbQuery ( db, "SELECT * FROM peds LIMIT 120" ), -1 )
    for index, variable in ipairs(P) do
        local X, Y, Z, R = variable['pos_x'], variable['pos_y'], variable['pos_z'], variable['rot_z']
        local ID, anim, wep = variable['sID'], getWeaponIDFromName(variable['anim']), variable['wep']
        local frozen, headless, muscels = variable['freeze'], variable['headless'], variable['muscels']
        
        CP = createPed(ID, X, Y, Z, R)
    end
end
addEventHandler("onResourceStart", resourceRoot, loadPeds)[/lua]

Edited by Rands
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...