SparkySky

need help with DayZ script

Recommended Posts

Hi all ! I have a problem !?! I have a DayZ MTA server and when I log in I randomly teleport and spam me with Account has been reset!

I use the MTA DayZ 0.7r3 gamemode !

can i change this script with another one? that when I go to another login panel I get a black screen!

look here for some pictures that randomly spawn me and spam me at Account is Buggy has been reset!

Photos: https://imgur.com/a/hEfCFXa

please help me well i am a beginner in scripting and i need help !!!
(Don't hate that you were like me too and you were scripting and asking for help)

 

function checkBuggedAccont(player)

  if isElement(player) then
        if not isGuestAccount(getPlayerAccount(player)) then
            if getElementData(player, "logedin") then
                if (getElementModel(player) == 0) then
                    removeBackpack(player);
                    removeWeaponBack(player);
                    removeWeaponBack2(player);
                    removeWeaponReplace(player);
                    spawnDayZPlayer(player);
                    outputChatBox(getPlayerName(player).."'s account is buggy and has been reset.", getRootElement(), 25, 255, 25);
                    return;
                end
                for _,v in ipairs(playerDataTable) do
                    if (type(getElementData(player, v[1])) ~= type(v[2])) then
                        removeBackpack(player);
                        removeWeaponBack(player);
                        removeWeaponBack2(player);
                        removeWeaponReplace(player);
                        spawnDayZPlayer(player);
                        outputChatBox(getPlayerName(player).."'s account is buggy and has been reset.", getRootElement(), 25, 255, 25);
                    end
                end
            end
        end
    end
end

addCommandHandler("kill", function(player)
    triggerEvent("kilLDayZPlayer", player);
end);

 

Share this post


Link to post

It appears your login panel spawns players in skin 0 (CJ) which is what DayZ uses to detect if an account is glitched. You should let DayZ handle the spawning while your login panel only logs the player in and sets his element data "logedin" (sic) to true

Share this post


Link to post
3 minutes ago, MrTasty said:

It appears your login panel spawns players in skin 0 (CJ) which is what DayZ uses to detect if an account is glitched. You should let DayZ handle the spawning while your login panel only logs the player in and sets his element data "logedin" (sic) to true

What ?! im need function for repairing problem ?!!!

Share this post


Link to post
20 hours ago, SparkySky said:

What ?! im need function for repairing problem ?!!!

If you do not understand the problem yet, how do you know that you need a function for repair?

I understand that you are a new scripter, but not understanding the nature of the function you are trying to fix is not handy.

The function is used to detect bugged accounts. Fix therefore the issue rather than the function that checks if issues occur.

Share this post


Link to post

Delete the for loop I think you have an outdated version.

This part of the code:

for _,v in ipairs(playerDataTable) do
  if (type(getElementData(player, v[1])) ~= type(v[2])) then
    removeBackpack(player);
    removeWeaponBack(player);
    removeWeaponBack2(player);
    removeWeaponReplace(player);
    spawnDayZPlayer(player);
    outputChatBox(getPlayerName(player).."'s account is buggy and has been reset.", getRootElement(), 25, 255, 25);
  end
end

Also just to ensure that everything is right delete internal.db 

Share this post


Link to post
22 hours ago, Tekken said:

Delete the for loop I think you have an outdated version.

This part of the code:


for _,v in ipairs(playerDataTable) do
  if (type(getElementData(player, v[1])) ~= type(v[2])) then
    removeBackpack(player);
    removeWeaponBack(player);
    removeWeaponBack2(player);
    removeWeaponReplace(player);
    spawnDayZPlayer(player);
    outputChatBox(getPlayerName(player).."'s account is buggy and has been reset.", getRootElement(), 25, 255, 25);
  end
end

Also just to ensure that everything is right delete internal.db 

I did as you said, but another problem appeared to me!
That's when I logged on to the server!
Here's a picture: https://imgur.com/a/oAJvIYZ

Share this post


Link to post
1 hour ago, SparkySky said:

I did as you said, but another problem appeared to me!
That's when I logged on to the server!
Here's a picture: https://imgur.com/a/oAJvIYZ

Type /debugscript 3

Without that you can't go any further. It will display scripts warning/errors.

Share this post


Link to post
9 minutes ago, majqq said:

Type /debugscript 3

Without that you can't go any further. It will display scripts warning/errors.

in /debugscript 3

I show no error everything is clean neither warnings nor errors !

look does not show me any error or warning, only the admin appears and so much!

https://imgur.com/a/daD2ISn

Edited by SparkySky

Share this post


Link to post

Hi all ! I found the problem so it does not spawn me and just shows me the interface from the 51st!

I don't know if this function works correctly!
Maybe someone can help me figure it out!

addEvent("onPlayerDayZRegister", true);
addEvent("onPlayerDayZLogin", true);
addEvent("kilLDayZPlayer", true);

addEventHandler("onPlayerDayZLogin", root, function(player)
    local account = getPlayerAccount(player);
    local x,y,z = getAccountData(account, "last_x"), getAccountData(account, "last_y"), getAccountData(account, "last_z");
    local skin = getAccountData(account, "skin");
    if getAccountData(account, "isDead") then
        return spawnDayZPlayer(player);
    end
    spawnPlayer(player, x, y, (z+2), math.random(360), skin, 0, 0);
    fadeCamera(player, true);
    setCameraTarget(player, player);
    local playerCol = createColSphere(x, y, z, 1.5);
    setElementData(player, "playerCol", playerCol);
    attachElements(playerCol, player, 0, 0, 0);
    setElementData(playerCol, "parent", player);
    setElementData(playerCol, "player", true);
    for _,v in ipairs(playerDataTable) do
        setElementData(player, v[1], getAccountData(account, v[1]));
    end
    setElementData(player, "logedin", true);
    setElementModel(player, getElementData(player, "skin"));
    setTimer(checkBuggedAccont, (25*1000), 1, player);
    setElementData(player, "spawnedzombies", 0);
    equipThem(player, 0);
end);

addEventHandler("onPlayerDayZRegister", getRootElement(), function(player)
    spawnDayZPlayer(player);
    setElementData(player, "radiochannel", "99999");
    setElementData(player, "gpschannel", "");
    setElementData(player, "gang", "None");
    savePlayerData(player);
end);

function spawnDayZPlayer(player)
    if player then
        local x,y,z = unpack(spawnPositions[math.random(#spawnPositions)]);
        spawnPlayer(player, x, y, (z+0.5), math.random(360), 73, 0, 0);
        setCameraTarget(player, player);
        fadeCamera(player, true);
        local playerCol = createColSphere(x, y, z, 1.5);
        setElementData(player, "playerCol", playerCol);
        attachElements(playerCol, player, 0, 0, 0);
        setElementData(playerCol, "parent", player);
        setElementData(playerCol, "player", true);
        setAccountData(getPlayerAccount(player), "isDead", false);
        setElementData(player, "isDead", false);
        setElementData(player, "logedin", true);
        for _,v in ipairs(playerDataTable) do
            if (v[1] ~= "radiochannel" and v[1] ~= "gpschannel") then
                setElementData(player, v[1], v[2]);
            end
        end
        setElementData(player, "logedin", true);
        setTimer(checkBuggedAccont, (25*1000), 1, player);
        setElementData(player, "spawnedzombies", 0);
    end
end

Share this post


Link to post

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.