Jump to content

Change player's skin through the serverevent called from client


Recommended Posts

So, I trying to change skin for player after registration. Im using

setElementModel(client, skin)
but it doesn't work. No errors in console or debugscript; "thePlayer", "root" doing errors.
setElementData & setPedWalkingStyle working good. How can I change the skin in this way?
Edited by DarkStalker30
Link to comment
  • DarkStalker30 changed the title to Change player's skin through the serverevent called from client
5 hours ago, Burak5312 said:

can you show the code

setElementData(client, "player.isCharCreator", false)--working good
setElementData(client, "player.sex", charTable[4])--working good
if charTable[4] then
   setPedWalkingStyle(client, 118)--working too
else
   setPedWalkingStyle(client, 129)--working too
end
setElementData(client, "player.skin", charTable[7])
local skin = tonumber(charTable[7])
setElementModel(client, skin)--didn't work

 

Edited by DarkStalker30
Link to comment

Previous and next codes working good, I'm spawning in dimension 0 on right coords and with normal camera.

setElementDimension(client, 0)
setElementData(client, "player.isCharCreator", false)
setElementData(client, "player.sex", charTable[4])
if charTable[4] then
   setPedWalkingStyle(client, 118)
else
   setPedWalkingStyle(client, 129)
end
setElementData(client, "player.skin", charTable[7])
local skin = tonumber(charTable[7])
setElementModel(player, skin)
setElementData(client, "player.pame", charTable[8])
setElementData(client, "player.isCharCreator", false)
spawnPlayer(client, 233.5927734375, -1278.25, 6.351, -100, 0, 0, 0)
fadeCamera(client, true)
setCameraTarget(client)

From client:
 

triggerServerEvent("endCreate", localPlayer)
Edited by DarkStalker30
Link to comment
setElementData(client, "player.isCharCreator", false)--working good
setElementData(client, "player.sex", charTable[4])--working good
if charTable[4] then
   setPedWalkingStyle(client, 118)--working too
else
   setPedWalkingStyle(client, 129)--working too
end
setElementData(client, "player.skin", charTable[7])
print(charTable[7]) --show me what is charTable[7]
local skin = tonumber(charTable[7])
setElementModel(client, skin)--didn't work

Can you debug the CharTable[7] data

  • Like 1
Link to comment
54 minutes ago, #!_A7M8D said:

Hello

 

Change

setElementModel(player, skin)

To

setElementModel(client, skin)

 

Cheers!

Already did, no any errors but didnt work.

 

28 minutes ago, Burak5312 said:
setElementData(client, "player.isCharCreator", false)--working good
setElementData(client, "player.sex", charTable[4])--working good
if charTable[4] then
   setPedWalkingStyle(client, 118)--working too
else
   setPedWalkingStyle(client, 129)--working too
end
setElementData(client, "player.skin", charTable[7])
print(charTable[7]) --show me what is charTable[7]
local skin = tonumber(charTable[7])
setElementModel(client, skin)--didn't work

Can you debug the CharTable[7] data

Debug is OK, right number in data. On spawn I have script for setting skin from data "player.skin" and it's working correct.

Link to comment

can you show more code

setElementDimension(client, 0)
setElementData(client, "player.isCharCreator", false)
setElementData(client, "player.sex", charTable[4])
if charTable[4] then
   setPedWalkingStyle(client, 118)
else
   setPedWalkingStyle(client, 129)
end
setElementData(client, "player.skin", charTable[7])
local skin = tonumber(charTable[7])
--setElementModel(player, skin) --no need this
setElementData(client, "player.pame", charTable[8])
setElementData(client, "player.isCharCreator", false)
spawnPlayer(client, 233.5927734375, -1278.25, 6.351, -100, skin, 0, 0) --use spawnPlayer skin parameter
fadeCamera(client, true)
setCameraTarget(client)

by the way, you don't need to use setElementModel, spawnPlayer function has skin parameter for it

Edited by Burak5312
  • Like 1
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...