Jump to content

setElementModel problem


mjau

Recommended Posts

Posted

A bit of client side

function armyspawn(button,state) 
    if button == "left" and state == "up" then 
        triggerServerEvent("movePlayerToPosition",getLocalPlayer(),207.00390625,1865.75390625,13.140625,0) 
        closeWindow() 
        removecursor() 
        armyskin(thePlayer) 
      end 
end 
  
function armyskin(thePlayer) 
setElementModel ( thePlayer, 287 ) 
end 

And my Serverside

function moveThePlayer(x,y,z,rotation) 
    if x and y and z and rotation then 
        spawnPlayer(source,x,y,z,rotation,skin) 
        setCameraTarget(source,source) 
    end 
end 
addEvent("movePlayerToPosition",true) 
addEventHandler("movePlayerToPosition",root,moveThePlayer)] 

It wont change the skin

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted

shall i add it serverside and how cuz that skin is for one button of the gui i made and i dont want that skin to be in every spawn

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted
function armyspawn(button,state) 
    if button == "left" and state == "up" then 
        triggerServerEvent("movePlayerToPosition",getLocalPlayer(),207.00390625,1865.75390625,13.140625,0) 
        closeWindow() 
        removecursor() 
        armyskin(getLocalPlayer()) 
      end 
end 
  
function armyskin(thePlayer) 
setElementModel ( thePlayer, 287 ) 
end 

Try that.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

hmm now it swaps over to the army skin and fast back to the skin i were using i can barely see it swaps before it goes back

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted

Try this:

--client side

function armyspawn(button,state) 
    if button == "left" and state == "up" then 
        triggerServerEvent("movePlayerToPosition",getLocalPlayer(),207.00390625,1865.75390625,13.140625,0,287) 
        closeWindow() 
        removecursor() 
      end 
end 

--server side

function moveThePlayer(x,y,z,rotation,skin) 
    if x and y and z and rotation and skin then 
        spawnPlayer(source,x,y,z,rotation,skin) 
        setCameraTarget(source,source) 
    end 
end 
addEvent("movePlayerToPosition",true) 
addEventHandler("movePlayerToPosition",root,moveThePlayer) 

As you can see i'm passing "skin" argument to the server side.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

No problem :D.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

What do you mean?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

like i create a table with the accounts wich are allowed to spawn and the script reads that table

I hate tables xD so give me a start ore sumething

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted

Client side

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_TabPanel = {} 
GUIEditor_Tab = {} 
  
function createthegui() 
showCursor(true,true) 
GUIEditor_Window[1] = guiCreateWindow(6,0,297,596,"Spawn menu",false) 
GUIEditor_Button[1] = guiCreateButton(12,24,98,43,"Adminspawn",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(176,38,88,33,"Pilot",false,GUIEditor_Window[1]) 
GUIEditor_Button[3] = guiCreateButton(16,87,89,41,"Robber",false,GUIEditor_Window[1]) 
GUIEditor_Button[4] = guiCreateButton(16,149,88,40,"Hobo",false,GUIEditor_Window[1]) 
GUIEditor_Button[5] = guiCreateButton(15,200,92,35,"Carjacker",false,GUIEditor_Window[1]) 
GUIEditor_Button[6] = guiCreateButton(17,245,88,38,"Army Rangers",false,GUIEditor_Window[1]) 
GUIEditor_Button[7] = guiCreateButton(12,288,92,40,"Arms Dealer",false,GUIEditor_Window[1]) 
GUIEditor_Button[8] = guiCreateButton(14,335,87,37,"Drug Dealer",false,GUIEditor_Window[1]) 
GUIEditor_Button[9] = guiCreateButton(13,377,88,36,"The Organisation",false,GUIEditor_Window[1]) 
GUIEditor_TabPanel[1] = guiCreateTabPanel(288,123,0,5,false,GUIEditor_Window[1]) 
GUIEditor_Tab[1] = guiCreateTab("Tab",GUIEditor_TabPanel[1]) 
addEventHandler("onClientGUIClick", GUIEditor_Button[1], teleportPlayer, false) 
addEventHandler("onClientGUIClick", GUIEditor_Button[6], armyspawn, false) 
end 
  
function openTeleportWindow() 
    createthegui() 
end 
addCommandHandler("teleportme",openTeleportWindow) 
  
function teleportPlayer(button,state) 
    if button == "left" and state == "up" then 
        triggerServerEvent("movePlayerToPosition",getLocalPlayer(),1479.6,-1612.8,14.0,69) 
        closeWindow() 
        removecursor() 
      end 
end 
  
function armyspawn(button,state) 
    if button == "left" and state == "up" then 
        triggerServerEvent("movePlayerToPosition",getLocalPlayer(),207.00390625,1865.75390625,13.140625,0,287) 
        closeWindow() 
        removecursor() 
      end 
end 
  
  
function closeWindow() 
    destroyElement(GUIEditor_Window[1]) 
end 
  
function removecursor() 
showCursor ( false ) 
end 
  

Server side

function moveThePlayer(x,y,z,rotation,skin) 
    if x and y and z and rotation and skin then 
        spawnPlayer(source,x,y,z,rotation,skin) 
        setCameraTarget(source,source) 
    end 
end 
addEvent("movePlayerToPosition",true) 
addEventHandler("movePlayerToPosition",root,moveThePlayer) 

n-560x95_E60303_FFFFFF_030303_FF0303.png

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