Jump to content

[help] spawn function²


Recommended Posts

function SpawnPlayer(thePlayer,skin,skin2,skin3,r,g,b) 
local n = math.random(1,3) 
if n == 1 then 
spawnPlayer ( thePlayer, -1494,921,8, 90.0, skin ) 
spawnPlayer ( thePlayer, 2005,1545,14, 90.0, skin3 ) 
else 
spawnPlayer ( thePlayer, 1178,-1325,15, 90.0, skin2 ) 
end 

want by for a player spawn in random place,the player comes in only two coordinates What did this wrong?

second doubt

function PlayerRespawn(diedPlayer) 
if not diedPlayer then else 
    toggleAllControls(diedPlayer,true) 
    setPlayerMoney(diedPlayer,StartMoney) 
    spawnPlayer ( diedPlayer, 1539.7673339844,-1352.8256835938,329.46545410156, 90.0,playerSkin[diedPlayer][1]) 
    setCameraTarget (diedPlayer, diedPlayer) 
end 
end 

I want when a player dies he is born in a coordinated random What did this wrong?

Link to comment

I made a system for when the player is born he is born in a random coordinate

That is one of 3 that I made at the beginning

function SpawnPlayer(thePlayer,skin,skin2,skin3,r,g,b) 
local n = math.random(1,3) 
if n == 1 then 
spawnPlayer ( thePlayer, -1494,921,8, 90.0, skin ) 
spawnPlayer ( thePlayer, 2005,1545,14, 90.0, skin3 ) 
else 
spawnPlayer ( thePlayer, 1178,-1325,15, 90.0, skin2 ) 
end 

But the player is not born at random What do I switch to when he spawn spawn random

Link to comment
function SpawnPlayer(thePlayer,skin,skin2,skin3,r,g,b) 
local n = math.random(1,3) 
if n == 1 then 
spawnPlayer ( thePlayer, -1494,921,8, 90.0, skin ) 
elseif n == 2 then 
spawnPlayer ( thePlayer, 2005,1545,14, 90.0, skin3 ) 
elseif n == 3 then 
spawnPlayer ( thePlayer, 1178,-1325,15, 90.0, skin2 ) 
end 
end 

Link to comment

Jacob works and when you die spawn in random coordinate ?

function PlayerRespawn(diedPlayer) 
if not diedPlayer then else 
    toggleAllControls(diedPlayer,true) 
    setPlayerMoney(diedPlayer,StartMoney) 
    spawnPlayer ( diedPlayer, 1539.7673339844,-1352.8256835938,329.46545410156, 90.0,playerSkin[diedPlayer][1]) 
    setCameraTarget (diedPlayer, diedPlayer) 
end 
end 

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