Jump to content

Spider Pork

Members
  • Posts

    60
  • Joined

  • Last visited

Posts posted by Spider Pork

  1. Note, the ped has NO control states or anything, it is simply just spawned.

    Don't think so. I guess the server might be running a fighting ped script or something?

  2. Can't see much point in creating water outside SA map, it's all water there anyway, isn't it?

    Yea, but maybe water above the normal water level there? Like some small lakes or something. I guess that's what he meant.

  3. Uhm... you forgot the addEventHandler function, trajik :P

    But I guess you want it in a command, right? Then it should look something like this:

    function command_makeStuff(player)
    local x, y, z = getElementPosition(player)
    createObject(2993, x, y, z, 120, 0, 0)
    outputChatBox("Party started", player, 0, 255, 0, true)
    end
    addCommandHandler("command", command_makeStuff)
    

  4. I kinda knew it's because I call the function again. But how else can I find a good skin without calling the function again? If I just leave it, nothing will happen if it doesn't pass the checks.

  5. Hello there!

    Why is this function...

    function setPlayerRandomSkin(player)
    randskin = math.random(288)
    if(isValidSkin(randskin) == true) then
    if(isRegimentSkin(randskin) == false) then
    local account = getPlayerAccount(player)
    setAccountData(account, "wwacc.skin", randskin)
    setElementModel(player, getAccountData(account, "wwacc.skin"))
    return getAccountData(account, "wwacc.skin")
    else
    		setPlayerRandomSkin(player)
    end
    else
    	setPlayerRandomSkin(player)
    end
    end
    

    ... returning me the "Stack overflow." error? What does it mean anyways?

  6. This is kinda weird. The variable is always a number until I restart the server. Then it becomes a boolean (false)... I've output its value everywhere I set it and also created a command to see it. It always sends a number, but when I restart the server it messes up to a boolean. I've also rewritten the whole script, here's the new login/register/spawning/test command code:

    function spawnHandler(posX, posY, posZ, spawnRotation, theTeam, theSkin, theInterior, theDimension)
    local account = getPlayerAccount(source)
     
    if account == false then
    outputChatBox("Error: You have to log in to spawn.", source, 255, 0, 0)
    cancelEvent()
    elseif account ~= false then
    if getAccountData(account, "wwacc.skin") == false or getAccountData(account, "wwacc.skin") == nil then
    setAccountData(account, "wwacc.skin", 0)
    end
     
    if getAccountData(account, "wwacc.justDied") == true then
    triggerClientEvent("showGUI_deathSelect", getRootElement())
    end
     
    setAccountData(account, "wwacc.timesSpawned", getAccountData(account, "wwacc.timesSpawned")+1)
    outputChatBox(tostring(getAccountData(account, "wwacc.timesSpawned")), source)
    end
    end
    addEventHandler("onPlayerSpawn", getRootElement(), spawnHandler)
     
    function command_test(playerSource, commandName, ...)
    outputChatBox(tostring(getAccountData(getPlayerAccount(playerSource), "wwacc.timesSpawned")))
    end
    addCommandHandler("test", command_test)
     
    function loginHandler(player, username, password)
    local account = getAccount(username, password)
     
    if account ~= false then
    if logIn(player, account, password) == true then
    triggerClientEvent("hideLoginWindow", player)
    setPlayerName(player, username)
     
    outputChatBox(tostring(getAccountData(account, "wwacc.timesSpawned")), source)
     
    if getAccountData(account, "wwacc.justDied") == true then
    triggerClientEvent("showGUI_deathSelect", getRootElement())
    elseif getAccountData(account, "wwacc.needsSelect") == true then
    triggerClientEvent("showGUI_teamSelect", player)
    elseif getAccountData(account, "wwacc.timesSpawned") > 0 then
    fadeCamera(player, true)
    spawnPlayer(player, getAccountData(account, "wwacc.xPos"), getAccountData(account, "wwacc.yPos"), getAccountData(account, "wwacc.zPos"), getAccountData(account, "wwacc.angle"), getAccountData(account, "wwacc.skin"), getAccountData(account, "wwacc.interior"))
    setCameraTarget(player, player)
    elseif getAccountData(account, "wwacc.timesSpawned") == 0 then
    if getAccountData(account, "wwacc.team") == 1 then
    fadeCamera(player, true)
    spawnPlayer(player, 245.9324, 1990.0793, 17.6406, 180, 287, 0, 0)
    setElementInterior(player, 0)
    setElementHealth(player, 100)
    setPedArmor(player, 0)
    setCameraTarget(player, player)
    elseif getAccountData(account, "wwacc.team") == 2 then
    fadeCamera(player, true)
    spawnPlayer(player, -2681.7974, 2151.6648, 55.8125, 180, 100, 0, 0)
    setElementInterior(player, 0)
    setElementHealth(player, 100)
    setPedArmor(player, 0)
    setCameraTarget(player, player)
    end
    end
    else
    outputChatBox("Error: Invalid username or password", source, 255, 0, 0)
    end
    else
    outputChatBox("Error: An account with that username doesn't exist.", source, 255, 0, 0)
    end
    end
    addEvent("onLogin", true)
    addEventHandler("onLogin", getRootElement(), loginHandler)
     
    function registerHandler(player, username, password)
    local account = getAccount(username)
     
    if account ~= false then
    if logIn(player, account, password) then
    triggerClientEvent("hideLoginWindow", player)
    setPlayerName(player, username)
    outputChatBox("You have been successfully logged in.", player)
    else
    outputChatBox("Error: Invalid password.", player, 255, 0, 0)
    end		
    else
    	account = addAccount(username, password)
    setAccountData(account, "wwacc.team", 0)
    setAccountData(account, "wwacc.needsSelect", true)
    setAccountData(account, "wwacc.waitingMoney", 0)
    setAccountData(account, "wwacc.money", 0)
    setAccountData(account, "wwacc.adminLevel", 0)
    setAccountData(account, "wwacc.muted", false)
    setAccountData(account, "wwacc.regimentMember", 0)
    setAccountData(account, "wwacc.regimentLeader", 0)
    setAccountData(account, "wwacc.hasRadio", false)
    setAccountData(account, "wwacc.radioFreq", 0)
    setAccountData(account, "wwacc.timesSpawned", 0)
     
    if logIn(player, account, password) == true then
    triggerClientEvent("hideLoginWindow", player)
    triggerClientEvent("showGUI_teamSelect", player)
    setPlayerName(player, username)
    outputChatBox("You have been successfully logged in.", player)
    else
    outputChatBox("Error: Fatal error occured. Please contact an administrator for help.", player, 255, 0, 0)
    end
    end
    end
    addEvent("onRegister", true)
    addEventHandler("onRegister", getRootElement(), registerHandler)
    

    What am I doing wrong?

  7. Create a checkpoint server-side. Then create a client-side event with the code to delete the checkpoint then server-side trigger it when you want to delete the checkpoint. Maybe that'll work?

×
×
  • Create New...