Jump to content

Problem in Spawn Again :(


Max+

Recommended Posts

Hello Guys when i press the button spawn , triggerServerEvent for spwn but it didn't spawn me ,

and the spawn point in Interior 3 ,

local spawns = { 
    { x = 238.6613311767, y = 141.05133056641,  z = 1003.0234375 }; 
    { x = 190.87297058105, y = 158.49531555176, z = 1003.0234375 }; 
    { x = 298.23620605496, y = 172.01306152344, z = 1007.171875 } 
} 
  
addEvent('onClientWatnsToSpawn', true) 
addEventHandler('onClientWatnsToSpawn', root, 
function (player) 
if not isElement(player) then return end 
x, y, z = unpack(spawns[math.random(#spawns)]) 
  setTimer ( spawnPlayer,3000,1,player, x, y, z,0,0,3,0 ); 
    setTimer ( fadeCamera, 3000, 1, player, true, 0.5 ) 
    setTimer ( setCameraTarget, 3000, 1, player, player ) 
    showCursor ( player, false ) 
    end 
) 
  
addEventHandler ( 'onPlayerWasted', root, 
    function (player) 
        fadeCamera ( player, false, 1.0, 0, 0, 0 ); 
        setTimer ( fadeCamera, 3500, 1, player, true, 0.5 ); 
         x, y, z = unpack(spawns[math.random(#spawns)]) 
        setTimer ( spawnPlayer,3000,1,player, x, y, z,0,0,3,0 ); 
    end 
) 

Link to comment

local spawns = { 
    { 238.6613311767,141.05133056641,1003.0234375 }; 
    { 190.87297058105,158.49531555176,1003.0234375 }; 
    { 298.23620605496,172.01306152344,1007.171875 }; 
}; 
  
addEvent('onClientWatnsToSpawn', true) 
addEventHandler('onClientWatnsToSpawn', root, 
function () 
    if not isElement(source) then return end 
local x, y, z = unpack(spawns[math.random(#spawns)]) 
    setTimer ( spawnPlayer,3000,1,source, x, y, z,0,0,3,0 ); 
    setTimer ( fadeCamera, 3000, 1, source, true, 0.5 ); 
    setTimer ( setCameraTarget, 3000, 1, source, source ); 
    showCursor ( source, false ); 
    end 
); 
  
addEventHandler ( 'onPlayerWasted', root, 
    function ( ) 
        fadeCamera ( source, false, 1.0, 0, 0, 0 ); 
        setTimer ( fadeCamera, 3500, 1, source, true, 0.5 ); 
         local x, y, z = unpack(spawns[math.random(#spawns)]); 
        setTimer ( spawnPlayer,3000,1,source, x, y, z,0,0,3,0 ); 
    end 
); 
Link to comment

Oh , if You Can Help Me with This i tryed fix it but i couldn't

the problem is when i select skin for example id 60

and when i spawn it dosnt give me the skin i have selected it's set my skin to 0 cj

StartSkin = 0 
triggerServerEvent('onClientWatnsToSpawn', getLocalPlayer(), StartSkin) 
----------------------- 
  

Link to comment

i alredy Tryed that ,

See ,

StartSkin = 0 
function start () 
    skin = createPed ( StartSkin, 2749.7502441406,-2232.7170410156,61.727611541748,60 ) 
     
    ------------------------- 
     
     
    addEventHandler('onClientGUIClick', root, 
    function ( ) 
    if ( source == spawnskin ) then 
    local Model = getElementModel(skin) 
    triggerServerEvent('onClientWatnsToSpawn', getLocalPlayer(), Model) 
---------------------------------------------------------------- 

it's give me Cj skin :(

addEventHandler('onClientGUIClick',root, 
function ( ) 
    if( source == rnextskin ) then 
    if StartSkin == 312 then 
        StartSkin = -1 
    elseif StartSkin == 2 then 
        StartSkin = 8 
    end 
        StartSkin = StartSkin + 1 
        setElementModel(skin,StartSkin) 
    end 
  
     
    addEventHandler('onClientGUIClick', root, 
    function ( ) 
        if ( source == lnextskin ) then 
        if StartSkin == 0 then 
        StartSkin = 313 
    elseif StartSkin == 9 then 
        StartSkin = 3 
    end 
        StartSkin = StartSkin - 1 
        setElementModel(skin,StartSkin) 
    end 

Link to comment

Try This ;

local id = 0 
for i = 0,312 do 
    skinID[i] = i 
end 
  
addEventHandler("onClientGUIClick",root, 
    function ( ) 
        if ( source == rnextskin ) then 
            do  
                id = id + 1  
                if id > #skinID then 
                    id = 0 
                end              
            end 
            if isElement(skin) then 
                while not setElementModel(skin, skinID[id]) do id = id + 1 end 
            end 
            elseif ( source == lnextskin ) then  
            do  
                id = id - 1 
                if id < 0 then 
                    id = #skinID 
                end          
            end 
            if isElement(skin) then 
                while not setElementModel(skin, skinID[id]) do id = id - 1 end 
            end  
        end 
    end 
); 
  
Link to comment

Aha , I Forget to create the table :

skinID = {} 
local id = 0 
for i = 0,312 do 
    skinID[i] = i 
end 
  
addEventHandler("onClientGUIClick",root, 
    function ( ) 
        if ( source == rnextskin ) then 
            do  
                id = id + 1  
                if id > #skinID then 
                    id = 0 
                end              
            end 
            if isElement(skin) then 
                while not setElementModel(skin, skinID[id]) do id = id + 1 end 
            end 
            elseif ( source == lnextskin ) then  
            do  
                id = id - 1 
                if id < 0 then 
                    id = #skinID 
                end          
            end 
            if isElement(skin) then 
                while not setElementModel(skin, skinID[id]) do id = id - 1 end 
            end  
        end 
    end 
); 
  
Link to comment

No -_- i test it now and works? u can try this one !

and see if it works or no ok?

Button_ = {} 
Left = {} 
Right = {} 
Spawn = {} 
skinID = {} 
local id = 0 
ped = createPed(0,x,y,z); 
setPedFrozen(ped,true); 
setPedAnimation(ped,"DANCING"," DAN_Down_A"); 
Left_Button = guiCreateButton(0.19, 0.75, 0.18, 0.04, "Previous", true); 
guiSetFont(Left_Button, "default-bold-small"); 
guiSetProperty(Left_Button, "NormalTextColour", "FFFE0000"); 
Right_Button = guiCreateButton(0.63, 0.76, 0.18, 0.04, "Next", true); 
guiSetFont(Right_Button, "default-bold-small"); 
guiSetProperty(Right_Button, "NormalTextColour", "FF01F4FD"); 
Spawn_Button = guiCreateButton(0.39, 0.70, 0.18, 0.04, "Spawn !", true); 
guiSetFont(Spawn_Button, "default-bold-small"); 
guiSetProperty(Spawn_Button, "NormalTextColour", "FF23FE00"); 
  
for i = 0, 400 do 
    skinID[i] = i 
end 
  
addEventHandler("onClientGUIClick",root, 
    function ( ) 
        if ( source == Right_Button ) then 
            do  
                id = id + 1  
                if id > #skinID then 
                    id = 0 
                end              
            end 
            if isElement(ped) then 
                while not setElementModel(ped, skinID[id]) do id = id + 1 end 
            end 
            elseif ( source == Left_Button ) then  
            do  
                id = id - 1 
                if id < 0 then 
                    id = #skinID 
                end          
            end 
            if isElement(ped) then 
                while not setElementModel(ped, skinID[id]) do id = id - 1 end 
            end  
        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...