Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2016-11-27, 15:25


Pumelowsky

Amator 3D






Wiek: 23
Na forum: 4181 dni
Posty: 199
Nick w MP: Pumelowsky

Piwa: 1666

Respekt: 200,5
Respekt: 200,5Respekt: 200,5

Witam ot?? napisa?em grosze na hudzie za pomoca string.gsub i chcialbym zeby przy przelewie,wystawianiu ceny auta. Jak wpisuje /przelej id 433.31 to przelewa sie 433 i zostaje 0.31. Jak zrobi? by grosze te? sie przelewaly?

KOD:
function zaplac(plrcmdtargetile)
    if not getElementData(plr"user:logged"then return end
    if not target or not ile then
        outputChatBox("#ffc800U?yj: #eeeeee/"..cmd.." [ID/Nazwa gracza] [Kwota]"plr255255255true)
        return
    end
    local target findPlayer(plrtarget)
    if not target then return end
     
    local ile tonumber(ile)
    string.format("%.2f",ile/100)
    string.gsub(ile"^(-?%d+)(%d%d)"'%1,%2')
    if not ile then
        exports.rpg_noti:createNotification(plr"error""Wpisana wartos? musi by? liczb?"1)
        return
    end
    local ile math.floor(ile)
    if ile 0.01 then
        exports.rpg_noti:createNotification(plr"error""Wpisana wartos? musi by? wi?ksza od 0"1)
        return
    end 
    local money1 getPlayerMoney(plr)
    string.format("%.2f",money1/100)
    string.gsub(money1"^(-?%d+)(%d%d)"'%1,%2')
    if money1 ile then
        exports.rpg_noti:createNotification(plr"error""Nie posiadasz przy sobie takiej sumy"1)
        return
    end
    takePlayerMoney(plrile*100)
    givePlayerMoney(target ,ile*100)
     string.gsub(ile"^(-?%d+)(%d%d)"'%1,%2')    
    
    outputChatBox("#c1c1c1Przekazujesz graczowi #e5e5e5"..getElementData(target"user:imie").." "..getElementData(target"user:nazwisko").."#c1c1c1 kwot? #e5e5e5"..ile.." PLN"plr255255255true)
    outputChatBox("#c1c1c1Otrzymujesz od gracza #e5e5e5"..getElementData(plr"user:imie").." "..getElementData(plr"user:nazwisko").."#c1c1c1 kwot? #e5e5e5"..ile.." PLN"target255255255true)


    local player_id getElementData(plr"user:uid")
    local player_name tostring(getElementData(target"user:imie").." "..getElementData(target"user:nazwisko"))
    local target_id getElementData(target"user:uid")
    local target_name tostring(getElementData(target"user:imie").." "..getElementData(target"user:nazwisko"))
    exports.rpg_admin:addToEcho("#71E83A[PRZELEW] #ffffff"..player_name.."/"..player_id.. " > "..target_name.."/"..target_id..": "..ile.." PLN")
end
addCommandHandler("przelej"zaplac)
addCommandHandler("zaplac"zaplac)

Prosz? o szybk? pomoc!!!

Podpis
Kontakt:

- Skype: live:pumapl_2
- GG: 56865468
- Discord: Pumelowsky#1126
- PW forum
[/center]
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-27, 17:52


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

PumaPL123,
 local ilosc "192.52"
 local pieniadze string.gsubilosc".""" )
result19252

sprawdz tak powino podzia?a? ;D

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-27, 18:28


Pumelowsky

Amator 3D






Wiek: 23
Na forum: 4181 dni
Posty: 199
Nick w MP: Pumelowsky

Piwa: 1666

Respekt: 200,5
Respekt: 200,5Respekt: 200,5

luki123luki123, Jak to w kodzie zastosowac?

Podpis
Kontakt:

- Skype: live:pumapl_2
- GG: 56865468
- Discord: Pumelowsky#1126
- PW forum
[/center]
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-27, 19:49


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4838 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

Do takich rzeczy mo?esz te? u?y? np. split, kt?ry Ci zwr?ci tabel? [1] to b?dzie cena przed kropk?, [2] to te Twoje upragnione grosze.

Bad? te? math.modf, kt?re rozbija liczb? do 2 zmiennych:


local liczba 192.52

local m1m2 math.modf(liczba)

print("ca?osci: "..m1.." grosze: "..m2)


Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-27, 20:01


Pumelowsky

Amator 3D






Wiek: 23
Na forum: 4181 dni
Posty: 199
Nick w MP: Pumelowsky

Piwa: 1666

Respekt: 200,5
Respekt: 200,5Respekt: 200,5

Niewa?ne juz sobie poradzilem, do zamknieca.

Podpis
Kontakt:

- Skype: live:pumapl_2
- GG: 56865468
- Discord: Pumelowsky#1126
- PW forum
[/center]
Postaw piwo autorowi tego posta
 

 
Tagi: grosze :: przy :: chatcie
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku