who can help me with this script

  • i dont now whats rong the scrip start up bhut i kant use them




    world = getWorld();
    database = getDatabase();


    function onEnable()
    print("test!");
    end


    function onPlayerCommand(event)
    local command = event.command;
    local cmd = StringUtils:explode(command, " ");

    if cmd[1] == "/setplace" then
    local PlayerName = event.player:getName();

    local PlaceTargetPos = event.player:getPosition();
    local PlaceNewPosx = PlaceTargetPos.x;
    local PlaceNewPosy = PlaceTargetPos.y;
    local PlaceNewPosz = PlaceTargetPos.z;

    result = database:query("SELECT PlacePos_x, PlacePos_y, PlacePos_z, count(ID) as count FROM home WHERE PlayerName = '".. PlayerName .."' ORDER BY id DESC LIMIT 1;")

    while result:next() do
    local count = result:getInt("count")
    if count > 0 then
    database:queryupdate("UPDATE `home` SET `Placepos_x` = '".. PlaceNewPosx .."', `Placepos_y` = '".. PlaceNewPosy .."', `PlaceposPos_z` = '".. PlaceNewPosz .."' WHERE `PlayerName` = '".. PlayerName .."';");
    event.player:sendTextMessage("Your home point has been changed.");
    else
    database:queryupdate("INSERT INTO home ('PlayerName', 'PlacePos_x', 'PlacePos_y', 'PlacePos_z') VALUES ('".. PlayerName .."', '".. PlaceNewPosx .. "', '".. PlaceNewPosy .. "', '".. PlaceNewPosz .. "')");
    event.player:sendTextMessage("Your new home point was created.");
    end
    end
    result:close();

    elseif cmd[1] == "/place" then
    local PlayerName = event.player:getName();

    result = database:query("SELECT PlacePos_x, PlacePos_y, PlacePos_z, count(ID) as count FROM home WHERE PlayerName = '".. PlayerName .."' ORDER BY id DESC LIMIT 1;")

    while result:next() do
    local count = result:getInt("count")
    if count > 0 then
    local newPosx = result:getString("PlacePos_x");
    local newPosy = result:getString("PlacePos_y") + 1.0;
    local newPosz = result:getString("PlacePos_z");
    event.player:setPosition(newPosx, newPosy, newPosz);
    event.player:sendTextMessage("You are bound to your home.");
    else
    event.player:sendTextMessage("Hmm, nothing found! You've probably made no sethome?!");
    end
    end
    result:close();

    elseif cmd[1] == "/homeadmin" then
    if not event.player:isAdmin() then
    event.player:sendTextMessage("[#FF0000][error] You are not an admin.");
    return;
    end
    if #cmd >= 2 then
    local PlayerName = cmd[2];
    result = database:query("SELECT PlacePos_x, PlacePos_y, PlacePos_z, count(ID) as count FROM home WHERE PlayerName = '".. PlayerName .."' ORDER BY id DESC LIMIT 1;")

    while result:next() do
    local count = result:getInt("count")
    if count > 0 then
    local newPosx = result:getString("PlacePos_x");
    local newPosy = result:getString("PlacePos_y") + 1.0;
    local newPosz = result:getString("PlacePos_z");
    event.player:setPosition(newPosx, newPosy, newPosz);
    event.player:sendTextMessage("You are on the home by the player".. PlayerName .." keep it clean.");
    else
    event.player:sendTextMessage("Hmm, nothing found! player ".. PlayerName .." probably made no sethome yet?!");
    end
    end
    result:close();
    else
    event.player:sendTextMessage("[#FF0000][tip] Use / home admin <name>");
    end
    end
    end
    addEvent("PlayerCommand", onPlayerCommand);

  • More information would be good, when you say it does not work what do you mean? Where did you get this script? It looks a lot like TMN home script.

    DEATH AND DESTRUCTION PVP
    192.154.229.151:4255


  • exactly i have try it to make the same as home bhut whit places :p that is a scrip of tmn first when i got the mesage unknown comand and than i have chane som things an now th script wil start bhut when i type in chat /set place than i got no message enter happens nothing

  • So it worked in the first place you made a change and it quit? What changes are you trying to make?BTW if you want to continue in your native language feel free Google translate works pretty good : )

    DEATH AND DESTRUCTION PVP
    192.154.229.151:4255


  • okay so sometimes I try. good for the brains.
    it has never really worked, I changed everything and the database as well.
    if I put everything back to normal sample, PlacePos_y PlacePos_z ..... etc back to HomePos_y HomePos_z ... etc and put the old database back everything works fine but people on my server sex but then served a home point. kite and I make something that other people platsen could make themselves as their home


    i hope you have enough greetz Jjustmee22

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!