Jump to content

Derpy

Members
  • Posts

    96
  • Joined

  • Last visited

Posts posted by Derpy

  1. thanks, i have been doing some tests with exports as i haven't used them before and it worked fine when i was exporting a function which would get text from my command 'ctrigger' and it'd output it to chatbox perfectly fine

    however when i have tried using dxDrawText function it simply outputted that the function didnt recieve any text

    exportResource(client.lua)

    local sw,sh = guiGetScreenSize() 
      
    function errorMessage(text) 
    if text then 
    dxDrawText(tostring(text),sw/2,sh/2,sw/2,sh/2,tocolor(255,255,255,255),1,"bankgothic","center","top",false,false,false,true) 
    else outputDebugString("exportResource: error; no text") return end 
    end 
      
    function removeErrorMessage() 
    removeEventHandler("onClientRender",root,errorMessage) 
    outputDebugString("exportResource: render handler removed!") 
    end 
      
    function addErrorMessage() 
    addEventHandler("onClientRender",root,errorMessage) 
    outputDebugString("exportResource: handler was added, it will be removed in 5 seconds") 
    setTimer(removeErrorMessage,5000,1) 
    end 
    

    test(client.lua) -- the resource which was supposed to send the text to exported resource

    function commandError(commandName,text) 
    exports.exportResource:errorMessage(text) 
    exports.exportResource:addErrorMessage() 
    outputDebugString("test:4: Export call was sent.") 
    end 
    addCommandHandler("ctrigger",commandError) 
    

    Additional Info of custom debugging:

    INFO: exportResource: handler was added, it will be removed in 5 seconds

    INFO: exportResource: Export call was sent.

    *** SPAM ***

    INFO: exportResource: error; no text

    *** END ***

    INFO: exportResource: render handler removed

    what am i doing wrong?

  2. alright and thank you for your replies.

    @eAi there's nothing wrong with it, I've just been wondering if there was an other way to do it.

    edit: if i was using an export from client to client to trigger an error message(with dx text) for a single client, would using localPlayer(in exported function) draw it for only the client that i've sent dx text to or would it draw for anyone?

  3. hello, you probably already know whats my question as it can be seen on my topic name

    anyway i have seen some scripts which basically call custom functions

    e.g

      
    if a = 1 then 
    createError("#1") return end 
      
    

    how could i share a function among all resources without exports?

    if it's impossible then how could i pass an element(probably player) to another script so that it would make that error only for the sent player element?

    i also know that type of a script can be "shared" in meta, can anyone explain what does that exactly mean?

    i hope you guys have understanded my question, if you know an answer to this, please reply.Thanks in advance.

  4. its an element as i stated above.

    i usually use it for setting specific datas, i will give you an example

    when player joins, source is the player who joined

    if i set a timer for another function to output message to that player who joined, in that another function, source will be nil

    and i would like to be able to retrieve player whenever i want without any handler

  5. hi is there any good host without lag and with a good ddos protection which has available MTA 1.4 to run on?

    Hi , if you are looking for a anti DDoS Hosting solution , also a powerfull one too , i recomend you Insane Hosting , All our servers are full DDoS protected , We accept Paypal , Bitcoin , DineroMail and SMS Payments

    We have two locations now , France and Dallas Texas Here is some test servers

    Dallas Texas:

    192.223.29.170:22163

    France:

    37.187.158.16:22013

    http://www.insane-hosting.net

    it seems like a good deal.

    just one more question.

    Do you have your servers on 1.4?if not, are they gonna be soon on 1.4?

    If an answer to any of these questions is yes, i'll definitely buy a server!

    also, will there be other server in europe for PRO plan, because now it seems that only USA server is available for PRO plan, and its kinda laggy for me as i'm far away from USA Server and close to France Server(in Europe)

    and

    Is it possible to get PRO Plan with SMS?

  6. hello im trying practice to know how triggerClientEvent/triggerServerEvent work but need help

    server

    function sendPlayerCount() 
    local playerCount = getPlayerCount() 
    triggerClientEvent("onPlayerCountChange",resourceRoot,playerCount) 
    end 
    addEventHandler("onPlayerJoin",root,sendPlayerCount) 
    addEventHandler("onPlayerQuit",root,sendPlayerCount) 
    

    client

    addEvent("onPlayerCountChange",true) 
    players = 0 
    local screenWidth,screenHeight = guiGetScreenSize() 
    function drawCount() 
    dxDrawText(players,screenWidth/2,screenHeight/2,screenWidth/2,screenHeight/2,tocolor(0,0,255,255),1,"bankgothic") 
    end 
    addEventHandler("onClientRender",root,drawCount) 
      
    function totalFreeroamPlayerNumber(playerCount)  
    if playerCount then 
    players = playerCount 
    else return end 
    end 
    addEventHandler("onPlayerCountChange",root,totalFreeroamPlayerNumber) 
    

  7.   
    function punishPlayer(thePlayer,commandName,target,time,reason) 
    local RootNode = xmlCreateFile("new.xml"," punishlist") 
    local xmlPunishNickBranch = xmlCreateChild ( RootNode, "punished_players_nick" ) 
    local xmlPunishSerialBranch = xmlCreateChild ( RootNode, "punished_players_serial" ) 
    local xmlPunishTimeBranch = xmlCreateChild ( RootNode, "punished_players_time" ) 
    local punishedPlayer = getPlayerFromName(target) 
    local punishedPlayerSerial = getPlayerSerial(target) -- line 8 
    local punishedPlayerSerialSource = getPlayerSerial(source) -- 9 
      if not RootNode then 
         xmlCreateFile("new.xml"," punishlist") 
         xmlCreateChild ( RootNode, "punished_players_nick" ) 
         xmlCreateChild ( RootNode, "punished_players_serial" ) 
         xmlCreateChild ( RootNode, "punished_players_time" ) 
    end 
    if RootNode then 
         if not isPlayerMuted(target) then 
               if time then 
                        if reason then 
                               setPlayerMuted(target,true) 
                               xmlNodeSetValue(xmlPunishNickBranch,punishedPlayer) 
                               xmlNodeSetValue(xmlPunishSerialBranch,punishedPlayerSerial) 
                               xmlNodeSetValue(xmlPunishTimeBranch,time) 
                               xmlSaveFile(RootNode) 
                               outputChatBox(punishedPlayer.." has been muted by: "..source.." for: "..time.." ("..reason..")") 
                               outputServerLog(punishedPlayer.." has been muted by: "..source.." for: "..time.." ("..reason..")") 
                                  else if not time then 
                                      outputChatBox("time not set",source) 
                                        else if not reason then 
                                              outputChatBox("reason not set",source) 
                                        end 
                                  end 
                            end 
                      end 
                end 
          end 
    end 
    addCommandHandler("punish",punishPlayer) 
      
    function onPunishedJoin() 
    if RootNode then 
    if punishedPlayerSerialSource == xmlNodeGetValue(xmlPunishSerialBranch) then 
    if xmlNodeGetValue(xmlPunishTimeBranch) >= 0 then 
    setPlayerMuted(source,true) 
    end 
    end 
    end 
    end 
    addEventHandler("onPlayerJoin",root,onPunishedJoin) 
    

    me no understand

    line 8 expected element got string *playernick*

    me not know how to put element so it work

    line 9 expected element got nil

    onplayerjoin source is player who entering servers and element so how error here?

    helpp

  8. hello im try to make this but it no work

    local RootNode = xmlCreateFile("new.xml"," punishlist") 
    local xmlPunishNickBranch = xmlCreateChild ( RootNode, "punished_players_nick" ) 
    local xmlPunishSerialBranch = xmlCreateChild ( RootNode, "punished_players_serial" ) 
    local xmlPunishTimeBranch = xmlCreateChild ( RootNode, "punished_players_time" ) 
    local punishedPlayer = getPlayerName(target) 
    local punishedPlayerSerial = getPlayerSerial(target) 
    local punishedPlayerSerialSource = getPlayerSerial(source) 
    function punishPlayer(thePlayer,commandName,target,time,reason) 
      if not RootNode then 
         xmlCreateFile("new.xml"," punishlist") 
         xmlCreateChild ( RootNode, "punished_players_nick" ) 
         xmlCreateChild ( RootNode, "punished_players_serial" ) 
         xmlCreateChild ( RootNode, "punished_players_time" ) 
    end 
    if RootNode then 
         if not isPlayerMuted(target) then 
               if time then 
                        if reason then 
                               setPlayerMuted(target,true) 
                               xmlNodeSetValue(xmlPunishNickBranch,punishedPlayer) 
                               xmlNodeSetValue(xmlPunishSerialBranch,punishedPlayerSerial) 
                               xmlNodeSetValue(xmlPunishTimeBranch,time) 
                               xmlSaveFile(RootNode) 
                               outputChatBox(punishedPlayer.." has been muted by: "..source.." for: "..time.." ("..reason..")") 
                               outputServerLog(punishedPlayer.." has been muted by: "..source.." for: "..time.." ("..reason..")") 
                                  else if not time then 
                                      outputChatBox("time not set",source) 
                                        else if not reason then 
                                              outputChatBox("reason not set",source) 
                                        end 
                                  end 
                            end 
                      end 
                end 
          end 
    end 
    addCommandHandler("punish",punishPlayer) 
      
    function onPunishedJoin() 
    if RootNode then 
    if punishedPlayerSerialSource == xmlNodeGetValue(xmlPunishSerialBranch) then 
    if xmlNodeGetValue(xmlPunishTimeBranch) >= 0 then 
    setPlayerMuted(source,true) 
    end 
    end 
    end 
    end 
    addEventHandler("onPlayerJoin",root,onPunishedJoin) 
    

    line 5 bad argument getPlayerName expected element at argument 1, got string *nickname*

    line 6 bad argument getPlayerSerial expected player at argument 1, got string *nickname*

    line 14 bad argument isPlayerMuted

    i am try to punish player for time in seconds i put and if time pass he get unmutted

    but if he reconnect he not evade mute and mute set back time and if time expired then player unmuted

    please help me bad at xml

×
×
  • Create New...