☻ᶠᶸᶜᵏᵧₒᵤ☻ Posted December 23, 2012 Posted December 23, 2012 Allora, c'è uno script che ho tradotto, ed è questo: https://community.multitheftauto.com/ind ... ls&id=6126 Vorrei far si che l'admin non debba scrivere "/math" per far uscire la domandina, ma vorrei forre automatico, tipo ogni minuto esce la domanda. C'è sicuramente una funzione vero? Grazie.
☻ᶠᶸᶜᵏᵧₒᵤ☻ Posted December 27, 2012 Author Posted December 27, 2012 grazie mille oggi la proverò e vi farò sapere. EDIT: come al solito non ci sono riuscito perchè ne so poco. Il codice è piccolo, dove dovrei inserire le stringhe? addCommandHandler("math", function(player) if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin" ) ) then reward = math.random(2000, 5000) qn1 = math.random(10, 100) qn2 = math.random(10, 100) qn3 = math.random(10, 100) theQuestion = qn1 + qn2 - qn3 outputChatBox("Matematica: Prima domanda "..qn1.." + "..qn2.." - "..qn3.." will win $" ..reward, root, 0, 255, 0, false) else outputChatBox("Tu non puoi usare questo comando", player, 255, 0, 0, false) end end ) addEventHandler("onPlayerChat", root, function(answer) if theQuestion and tonumber(answer) == theQuestion then theQuestion = nil outputChatBox("Matematica: "..getPlayerName(source).." #00FF00ha risposto "..answer.." e ha vinto $"..reward, root, 0, 255, 0, true) givePlayerMoney(source, reward) end end ) E poi scusatemi, ma sono negato, ma in questo script vorrei fare botta e risposta, cioè: function mainFunction() outputChatBox ("Niko: Lo sapevi che il server ha un forum?") setTimer ( function() outputChatBox ( "Luis: No non lo sapevo" ) outputChatBox ( "Niko: Invece si, il server ha un forum a cui tutti noi dovremmo partecipare!" ) outputChatBox ( "Luis: Allora dammi il link no?" ) outputChatBox ( "CJ: te lo do io che quel poltrone di Niko sta fumando una canna. Allora eccoti il link: sa-iexperts.forumfree.it" ) end, 5000, 1 ) end mainFunction() --call function Come è possibile fare che non escano tutte insieme le frasi?
HunT Posted December 27, 2012 Posted December 27, 2012 Per quanto riguarda il math prova questo : variabile = 0 function mathManager (player) if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin" ) ) then if variabile == 0 then outputChatBox( getPlayerName(player).. " : Enable The Math", getRootElement(), 255, 200, 0, true) variabile=1 elseif variabile == 1 then variabile = 0 outputChatBox( getPlayerName(player).. " : Disable The Math", getRootElement(), 255, 200, 0, true) end end end variabile = 0 addCommandHandler ( "mathmanager", mathManager ) function mathQuestion () reward = math.random(2000, 5000) qn1 = math.random(10, 100) qn2 = math.random(10, 100) qn3 = math.random(10, 100) theQuestion = qn1 + qn2 - qn3 outputChatBox("Math: First one to answer "..qn1.." + "..qn2.." - "..qn3.." will win $" ..reward, root, 0, 255, 0, false) end addEventHandler("onPlayerChat", root, function(answer) if theQuestion and tonumber(answer) == theQuestion then theQuestion = nil outputChatBox("Math: "..getPlayerName(source).." #00FF00answered "..answer.." and won $"..reward, root, 0, 255, 0, true) givePlayerMoney(source, reward) end end ) setTimer( function() if variabile == 1 then mathQuestion () end end , 30000, 0) Per attivare il math devi usare /mathmanager in chat Devi editare il tempo nel setTimer,ora e settato a 30000. Per la seconda domanda puoi usare il setTimer come ti ho mostrato sopra Esempio : setTimer( function() outputChatBox ("Niko: Lo sapevi che il server ha un forum?") end , 100, 1) setTimer( function() outputChatBox ( "Luis: No non lo sapevo" ) end , 1000,1) -- dopo un secondo Spero tu abbia capito
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now