Jump to content

Dzemous

Members
  • Posts

    11
  • Joined

  • Last visited

Details

  • Gang
    GS
  • Location
    Poland
  • Occupation
    Programmer (amateur
  • Interests
    LUA

Dzemous's Achievements

Square

Square (6/54)

0

Reputation

  1. Hi! I am writing a script to transfer money from one player's account to another. I have already written a code to collect money from the sender's account, but I have no idea how to add the money to the recipient's account. I know that the function responsible for adding money is https://wiki.multitheftauto.com/wiki/GivePlayerMoney and looks like this bool givePlayerMoney ( player thePlayer, int amount ) And I want to use it to add money to another player's account. How do I specify the name of the recipient's account in this function? I have to use "for" for this or how can I still do it? My code (this is s-side): function przekaz (nadawca, komenda, odbiorca, kwota) -- who used command, commandname, the variable of the player to whom the money is transferred, amount local pieniazki = tonumber(kwota) --variable amount if (getPlayerMoney(nadawca)==pieniazki) or (getPlayerMoney(nadawca)>pieniazki) then --if the player's amount is equal to or greater than the amount to be sent takePlayerMoney (nadawca, kwota) -- collects the amount of money sent from the player's account outputChatBox("Wysłałeś kwotę" ..pieniazki.. "graczowi" ..odbiorca , nadawca) --sends a successful transaction notification --here is to be a line with a function whose task is to add a specific amount to the player's account. end end addCommandHandler("zaplac", przekaz) addCommandHandler("dajkase", przekaz) addCommandHandler("przelej", przekaz)
  2. Yes, I know. I prefer to do it on c-side ; p At least I learn how trigger. I don't know what i must using in argument with element (2)
  3. Hi, I will doing job, but I always have got problem with arguments in trigger I read Elements Tree on wiki, but I still do not know what this is about When player hit marker then s-side must create vehicle. C-side StartJobM = createMarker (-165.35049, 1059.69141, 18.74219, 'cylinder', 1.0, 22, 38, 199, 255) function StartJob (hitPlayer, matchingDimension) if isPedInVehicle (hitPlayer) then outputChatBox ("You can't hit marker when u are in vehicle!") cancelEvent () if getElementType(hitPlayer) == getlocalPlayer then triggerServerEvent ("poj", localPlayer ) outputChatBox ("Created vehicle!") end end end addEventHandler ("onClientMarkerHit", StartJobM, StartJob) StartJobM = createMarker (-165.35049, 1059.69141, 18.74219, 'cylinder', 1.0, 22, 38, 199, 255) function StartJob (hitPlayer, matchingDimension) if isPedInVehicle (hitPlayer) then outputChatBox ("You can't hit marker when u are in vehicle!") cancelEvent () if getElementType(hitPlayer) == getlocalPlayer then triggerServerEvent ("poj", localPlayer ) outputChatBox ("Created vehicle!") end end end addEventHandler ("onClientMarkerHit", StartJobM, StartJob) S-side: function VehicleC() lcvehi = createVehicle (422, -158.49141, 1051.20691, 19.75892) end addEvent("poj") addEventHandler("poj", getRootElement(), VehicleC) Please, explain me how i Can triggering
  4. Lasts arguments in function attachElements are offset. How I can get offset?
  5. Hello guys! I doing panel registration. How I can upload text with EditBox with c-side to s-side? When player click button "Registration" then script must take Login and Password with EditBox and s-side must does function addAccount . This is snippet code c-side: local DaneR_Login = guiGetText (GUIREGISTER.Places_R_Register[1]) --Getting login with editbox local DaneR_Passy = guiGetText (GUIREGISTER.Places_R_Register[2]) --Getting password with edibot local StworzKonto = triggerServerEvent ("StworzKonto", getLocalPlayer ()) --trigger (addaccount) if StworzKonto then outputChatBox ("Pomyślnie utworzono konto o nazwie: "..DaneR_Login) --If s-side addAccount else outputChatBox ("Nie udało się utworzyć konta") --if not addAccount end end end end end addEventHandler ("onClientGUIClick", root, CreateAccountPlayer) S-side function StworzKontoWBazieDanych() addAccount ('DaneR_Login', 'DaneR_Passy') --DaneR_Login and DaneR_Passy this are local with c-side. They getting login and password with editbox. end addEvent("StworzKonto",true) addEventHandler("StworzKonto", getRootElement(), StworzKontoWBazieDanych) 0 db. How I can upload this locals?
  6. Hello! I doing script Panel register and Login. How can I check the length text in editbox? I used: if #GUIREGISTER.Places_R_Register[1] > 0 and #GUIREGISTER.Places_R_Register[1] <=20 then , but this is bad. DB3: Attemp to get length of field '?' (a userdata value) I haven't got idea how to do
  7. Ok, thanks Can close this topic.
  8. I don't will create multi data base. I want to have one for everything
  9. Why this connect doesn't work? local connect = dbConnect("sqlite",":resources/Mlife.db") Script is in: Resources/ZP (ZP this folder with script) Data Base File is in main folder with scripts. Script can't find data base file about name Mlife.db, but this data base file there is
  10. Hello guys, I'm beginners in LUA. Why this code doesn't work? 0 DB When player joined, server giving he skin about ID 0 C-side function SskinC () triggerServerEvent ("SetSkinPlayerJoin", resourceRoot) end addEventHandler ("onClientPlayerJoin", getRootElement(), SskinC) S-side function UstawSkina() setElementModel(client, 0) end addEvent("SetSkinPlayerJoin", true) addEventHandler("SetSkinPlayerJoin", resourceRoot, UstawSkina) I don't know when I must write resourceRoot, root, getRootElement, etc. and this is my problem (Sorry for my english, but i can't pefrect his :/)
×
×
  • Create New...