Jump to content

spawn ped with a id number specific


Enargy,

Recommended Posts

Hello, I'm finishing a script said a ped, which tries to create a ped with a specific ID, but my question is. What is a table or to choose a specific number of skin ?

For example: "/ped 1" = 240 or "/ped 2" = 217

pedCreated = function pedCreated(command) 
        local x, y, z = getElementPosition(source) 
        local pedModel = createPed(0, x, y + 5, z) 
end  
addCommandHandler("ped", pedCreated) 

Link to comment
  
pedCreated = function (player,_,pedid) 
        local x, y, z = getElementPosition(player) 
        local pedModel = createPed(tonumber(pedid), x, y + 5, z) 
end 
addCommandHandler("ped", pedCreated) 
  

This is a server-side script. What it does is: it gets the id you specify when you use the command (example: /ped 23) and stores it in pedid as a string. Then it runs the function and creates a ped with the id you specified.

Link to comment
  • Moderators

This ? (server-script)

local skinList = { 
    240, -- 1 
    217  -- 2 
} 
  
function pedCreated(thePlayer, cmd, skinNumber) 
    local x, y, z = getElementPosition(thePlayer) 
    local thePed = createPed(skinList[tonumber(skinNumber)] or 0, x, y + 5, z) 
end 
addCommandHandler("ped", pedCreated) 

Edited by Guest
Link to comment
  • Moderators
No Citizen , He wants that he uses /ped skinID and he will get the skin. Any skin ID. Not only theese two.

For me, this:

For example: "/ped 1" = 240 or "/ped 2" = 217

For me it means that he wants to spawn a ped with the skin id 240 when he writes /ped 1 etc.

Of course he can add other skins to the list.

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...