Jump to content

cerere script pentru dm xmas


Recommended Posts

hey multumesc celor care ma sustin in continuare cu serverul meu de basemode

acum am nevoie din nou de voi

sunt niste script-uri care chiar nu stiu cum sa le scriu

1./xmas sa apara caciula pe cap

2.cand scrii /happy or /sad sa apara ceva de genul

AndreiOptyck is sad :( sau is happy .

si altul 3.cand scrii /pee sa se pise

incerc sa imbin utilul cu placutul

Link to comment

Deci scripturile acestea sunt cele mai usoare care le-am vazut vre-o data...

Happy/sad:

  
states = { 
    ["fericit"] = true, 
    ["trist"] = true, 
    ["smecher"] = true, 
    ["nebun"] = true, 
    ["tampit"] = true, 
} 
  
function setPlayerState(player, cmd, state) 
   if not tostring(state) then 
       outputChatBox("[sYNTAXA] /setstate", player) 
        for k, v in pairs(states) do 
            outputChatBox(k, player) 
        end 
       return 
    end 
       state  = string.lower(tostring(state)) 
       if states[state] then 
           setElementData(player, state) 
           outputChatBox(player.." se simte "..state, 255, 255, 0) 
       else 
            outputChatBox("Acest status nu exist, te rugam sa introduci din urmatoarele:", player, 255, 255, 0) 
            for k, v in pairs(states) do 
                 outputChatBox(k, player) 
            end 
       end 
end 
addCommandHandler("setstate", setPlayerState) 

Caciula:

Server-side:

addEvent('helmet:updateHelmet', true) 
addEvent('helmet:toggleHelmet', true) 
  
local helmet = {} 
  
function removeHelmet(thePlayer) 
    if (getElementData(client, "helmeton") == true) then 
        triggerEvent("helmet:toggleHelmet", client, client) 
    else 
        return 
    end 
end 
addEventHandler("onPlayerQuit", root, removeHelmet) 
  
function helmet_toggleHelmet(p) 
    local int = getElementInterior(p) 
    local dim = getElementDimension(p) 
    setElementData(p, 'helmeton', false) 
    if not helmet[p] then  
        local x, y, z = getElementPosition(p) 
        local helmetobj = createObject(2799, x, y, z) 
        setElementInterior(helmetobj, int) 
        setElementDimension(helmetobj, dim) 
        setObjectScale(helmetobj, 2.6) 
        setElementDoubleSided(helmetobj, false) 
        exports.bone_attach:attachElementToBone(helmetobj,p,1,0,0.037,0.08,7.5,0,180) 
        triggerClientEvent(p, 'helmet:startChecking', p, true) 
        helmet[p] = helmetobj 
        setElementData(p, 'helmeton', true) 
    else 
        triggerClientEvent(p, 'helmet:startChecking', p, false) 
        destroyElement(helmet[p]) 
        helmet[p] = nil 
        setElementData(p, 'helmeton', false) 
    end 
end 
addEventHandler('helmet:toggleHelmet', root, helmet_toggleHelmet) 
addCommandHandler("xmas", helmet_toggleHelmet) 
  
addEventHandler("onPlayerQuit", root, 
function() 
    if helmet[source] then 
        destroyElement(helmet[source]) 
        helmet[source] = nil 
    end 
end) 
  
  
addEventHandler('helmet:updateHelmet', root, 
function(p, newInt, newDim) 
    setElementInterior(helmet[p], newInt) 
    setElementDimension(helmet[p], newDim) 
end) 

Client-side:

addEvent('helmet:startChecking', true) 
  
local currentInterior, currentDimension = 0, 0 
  
function helmet_startChecking(check) 
    check = check or false 
    if check then 
        currentInterior, currentDimension = getElementInterior(localPlayer), getElementDimension(localPlayer) 
        addEventHandler('onClientPreRender', root, helmet_checkHelmet) 
    else 
        removeEventHandler('onClientPreRender', root, helmet_checkHelmet) 
    end 
end 
  
function helmet_checkHelmet() 
    local newInterior, newDimension = getElementInterior(localPlayer), getElementDimension(localPlayer) 
    if currentInterior ~= newInterior or currentDimension ~= newDimension then 
        triggerServerEvent('helmet:updateHelmet', root, localPlayer, newInterior, newDimension) 
        currentInterior, currentDimension = newInterior, newDimension 
    end 
end 
addEventHandler('helmet:startChecking', root, helmet_startChecking) 

P.S: Nu le-am testat dar ar trebuii sa mearga (AI NEVOIE DE RESURSA BONE_ATTACH PENTRU CACIULA)

Link to comment

[quote name=..:D&G:..]Deci scripturile acestea sunt cele mai usoare care le-am vazut vre-o data...

Happy/sad:

  
states = { 
    ["fericit"] = true, 
    ["trist"] = true, 
    ["smecher"] = true, 
    ["nebun"] = true, 
    ["tampit"] = true, 
} 
  
function setPlayerState(player, cmd, state) 
   if not tostring(state) then 
       outputChatBox("[sYNTAXA] /setstate", player) 
        for k, v in pairs(states) do 
            outputChatBox(k, player) 
        end 
       return 
    end 
       state  = string.lower(tostring(state)) 
       if states[state] then 
           setElementData(player, state) 
           outputChatBox(player.." se simte "..state, 255, 255, 0) 
       else 
            outputChatBox("Acest status nu exist, te rugam sa introduci din urmatoarele:", player, 255, 255, 0) 
            for k, v in pairs(states) do 
                 outputChatBox(k, player) 
            end 
       end 
end 
addCommandHandler("setstate", setPlayerState) 

Caciula:

Server-side:

addEvent('helmet:updateHelmet', true) 
addEvent('helmet:toggleHelmet', true) 
  
local helmet = {} 
  
function removeHelmet(thePlayer) 
    if (getElementData(client, "helmeton") == true) then 
        triggerEvent("helmet:toggleHelmet", client, client) 
    else 
        return 
    end 
end 
addEventHandler("onPlayerQuit", root, removeHelmet) 
  
function helmet_toggleHelmet(p) 
    local int = getElementInterior(p) 
    local dim = getElementDimension(p) 
    setElementData(p, 'helmeton', false) 
    if not helmet[p] then  
        local x, y, z = getElementPosition(p) 
        local helmetobj = createObject(2799, x, y, z) 
        setElementInterior(helmetobj, int) 
        setElementDimension(helmetobj, dim) 
        setObjectScale(helmetobj, 2.6) 
        setElementDoubleSided(helmetobj, false) 
        exports.bone_attach:attachElementToBone(helmetobj,p,1,0,0.037,0.08,7.5,0,180) 
        triggerClientEvent(p, 'helmet:startChecking', p, true) 
        helmet[p] = helmetobj 
        setElementData(p, 'helmeton', true) 
    else 
        triggerClientEvent(p, 'helmet:startChecking', p, false) 
        destroyElement(helmet[p]) 
        helmet[p] = nil 
        setElementData(p, 'helmeton', false) 
    end 
end 
addEventHandler('helmet:toggleHelmet', root, helmet_toggleHelmet) 
addCommandHandler("xmas", helmet_toggleHelmet) 
  
addEventHandler("onPlayerQuit", root, 
function() 
    if helmet[source] then 
        destroyElement(helmet[source]) 
        helmet[source] = nil 
    end 
end) 
  
  
addEventHandler('helmet:updateHelmet', root, 
function(p, newInt, newDim) 
    setElementInterior(helmet[p], newInt) 
    setElementDimension(helmet[p], newDim) 
end) 

Client-side:

addEvent('helmet:startChecking', true) 
  
local currentInterior, currentDimension = 0, 0 
  
function helmet_startChecking(check) 
    check = check or false 
    if check then 
        currentInterior, currentDimension = getElementInterior(localPlayer), getElementDimension(localPlayer) 
        addEventHandler('onClientPreRender', root, helmet_checkHelmet) 
    else 
        removeEventHandler('onClientPreRender', root, helmet_checkHelmet) 
    end 
end 
  
function helmet_checkHelmet() 
    local newInterior, newDimension = getElementInterior(localPlayer), getElementDimension(localPlayer) 
    if currentInterior ~= newInterior or currentDimension ~= newDimension then 
        triggerServerEvent('helmet:updateHelmet', root, localPlayer, newInterior, newDimension) 
        currentInterior, currentDimension = newInterior, newDimension 
    end 
end 
addEventHandler('helmet:startChecking', root, helmet_startChecking) 

P.S: Nu le-am testat dar ar trebuii sa mearga (AI NEVOIE DE RESURSA BONE_ATTACH PENTRU CACIULA)

BONE_ATTACH: https://community.multitheftauto.com/ind ... ls&id=2540

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