Jump to content

Bug


-.Paradox.-

Recommended Posts

Hello i got a problem with my script, when player login i can't see the skins that i want to choose thanks for helping.

local mySkins = 
    { 
        284, 
        40, 
        18, 
        172 
    } 
local index = { } 
  
function Selection ( player ) 
    showCursor ( player, true ) 
    bindKey ( player, "rshift", "down", Spawn ) 
    bindKey ( player, "arrow_l", "down", SwitchSkin ) 
    bindKey ( player, "arrow_r", "down", SwitchSkin ) 
    fadeCamera ( player, true ) 
    index [ player ] = 1 
end 
  
function Selection2 ( player ) 
    if ( not isPedDead ( player ) ) then 
        outputChatBox ( " ", player, 0, 255, 0 ) 
        outputChatBox ( "You'll choose your skin again.", player, 0, 138, 138 ) 
        outputChatBox ( "Press Arrow keys to switch skins and Right shift to spawn!", player, 0, 138, 138 ) 
        killPed ( player, player ) 
    end 
    setTimer ( Selection, 1000, 1, player ) 
end 
  
function SwitchSkin ( player, key ) 
    if ( key == "arrow_l" ) then 
        if ( index [ player ] == 1 ) then 
            index [ player ] = #mySkins 
        else 
            index [ player ] = ( index [ player ] - 1 ) 
        end 
    else 
        if ( index [ player ] == #mySkins ) then 
            index [ player ] = 1 
        else 
            index [ player ] = ( index [ player ] + 1 ) 
        end 
    end 
    setElementModel ( player, mySkins [ index [ player ] ] ) 
    playSoundFrontEnd ( player, 32 ) 
end 
  
function Spawn ( player ) 
    showCursor ( player, false ) 
    playSoundFrontEnd ( player, 44 ) 
    outputChatBox("Done!", player, 0, 255, 138) 
    unbindKey ( player, "rshift", "down", Spawn ) 
    unbindKey ( player, "arrow_l", "down", SwitchSkin ) 
    unbindKey ( player, "arrow_r", "down", SwitchSkin ) 
    setCameraTarget ( player, player ) 
end 
  
function GamemodeStart ( res ) 
    local players = getElementsByType ( "player" ) 
    for _, v in ipairs ( players ) do 
        bindKey ( v, "F4", "down", Selection2 ) 
        outputChatBox ( "< Press Arrow keys to switch skins and Right shift to spawn. >", v, 255, 138, 0 ) 
        setTimer ( SpawnPlayer, 1000, 1, v ) 
        setTimer ( Selection, 1000, 1, v ) 
        fadeCamera ( v, true ) 
    end 
end 
  
function GamemodeEnd ( res ) 
    local players = getElementsByType ( "player") 
    for _, v in ipairs ( players ) do 
        unbindKey ( v, "F4", "down", Selection2 ) 
    end 
end 
  
function PlayerDeath ( ) 
    spawnPlayer ( source, -1643.89941, 652.95648, -4.90625, 269.1424, 172 ) 
end 
  
function SpawnPlayer ( source ) 
    spawnPlayer ( source, -1643.89941, 652.95648, -4.90625, 269.1424, 172 ) 
  
end 
  
function PlayerJoin ( ) 
    bindKey ( source, "F4", "down", Selection2 ) 
    outputChatBox ( "Welcome to Resident Evil Server Zombie Invasion", source, 255, 255, 0 ) 
    outputChatBox ( "< Press Arrow Keys to switch skins and Right shift to spawn. >", source, 255, 255, 0 ) 
    setTimer ( SpawnPlayer, 1000, 1, source ) 
    fadeCamera (source, true ) 
    setTimer ( Selection, 1500, 1, source ) 
end 
  
function PlayerLogin ( ) 
    bindKey ( source, "F4", "down", Selection2 ) 
    outputChatBox ( "Welcome to Resident Evil Server Zombie Invasion", source, 255, 255, 0 ) 
    outputChatBox ( "< Press Arrow Keys to switch skins and Right shift to spawn. >", source, 255, 255, 0 ) 
    setTimer ( SpawnPlayer, 1000, 1, source ) 
    fadeCamera (source, true ) 
    setTimer ( Selection, 1500, 1, source ) 
end 
  
addEventHandler("onPlayerWasted", getRootElement(),PlayerDeath) 
addEventHandler ( "onResourceStart", resourceRoot, GamemodeStart ) 
addEventHandler ( "onResourceStop", resourceRoot, GamemodeEnd ) 
addEventHandler ( "onPlayerJoin", getRootElement(), PlayerJoin ) 
addEventHandler ( "onPlayerLogin", getRootElement(), PlayerLogin ) 

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