Jump to content

kuba90pl

Members
  • Posts

    36
  • Joined

  • Last visited

Everything posted by kuba90pl

  1. kuba90pl

    Problem

    hello i need again help skins.xml <skins> <skin model="1" name="skin1"/> <skin model="2" name="skin2"/> <skin model="20" name="skin21"/> </skins> client: function cp () local skinList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.30, true ) local column = guiGridListAddColumn( skinList, "Skins", 0.85 ) if ( column ) then local xml = getResourceConfig("skins.xml") for id, skin in ipairs(xmlNodeGetAttribute(xml, "model")) do local row = guiGridListAddRow ( skinList ) guiGridListSetItemText ( skinList, row, column, skin, false, false ) end end end i want to get skins name from skins.xml and paste it in gridlist , but its not working .request help here!
  2. kuba90pl

    Problem

    Hi ! i made an script which show stats : server: function requestShowStats(player) local acc=getPlayerAccount(player) local czas=getAccountData(acc,"player.gametime") local x=getAccountData(acc,"player.locx") local y=getAccountData(acc,"player.locy") local z=getAccountData(acc,"player.locz") local lastvisit=getAccountData(acc,"player.lastvisit") local cash=getAccountData(acc,"player.money") local email=getAccountData(acc,"player.email") local age=getAccountData(acc,"player.age") triggerClientEvent ( "onShowStats", player,czas,x,y,z,lastvisit,cash,email,age) end client: checkShowStats=0 function showStats(czas,x,y,z,lastvisit,cash,email,age) if checkShowStats==0 then local w,s=guiGetScreenSize() checkShowStats=1 showCursor(true) winrss = guiCreateWindow(w/2-100,-50,450,430,"Oli Login",false) totalSec=czas local seconds = math.fmod(math.floor(totalSec), 60) local minutes = math.fmod(math.floor(totalSec/60), 60) local hours = math.fmod(math.floor(totalSec/3600), 24) local days = math.floor(math.floor(totalSec/3600)/24) local total = ""..days.." days, "..hours.." hours, "..minutes.." minutes and "..seconds.." seconds." lab1 = guiCreateLabel(50,100,300,37,total,false,winrss) pozycja=""..x.."x "..y.."y "..z.."z" lab2 = guiCreateLabel(50,150,144,37,pozycja,false,winrss) godzina=string.sub(lastvisit,1,2) minuta=string.sub(lastvisit,4,5) dzien=string.sub(lastvisit,7,8) lsvt=" "..godzina..":"..minuta.." "..dzien.." November!" lab3 = guiCreateLabel(50,200,144,37,lsvt,false,winrss) money=""..cash.."$" lab4 = guiCreateLabel(50,250,144,37,money,false,winrss) lab5 = guiCreateLabel(50,300,144,37,email,false,winrss) lab6 = guiCreateLabel(50,350,144,37,age,false,winrss) but1ss = guiCreateButton(50,400,81,34,"Close",false,winrss) lab7= guiCreateLabel(50,75,144,37,"Total time spend:",false,winrss) lab8= guiCreateLabel(50,125,144,37,"Your position:",false,winrss) lab9= guiCreateLabel(50,175,144,37,"Your last activity:",false,winrss) lab10= guiCreateLabel(50,225,144,37,"Your money:",false,winrss) lab11= guiCreateLabel(50,275,144,37,"Your Email",false,winrss) lab12= guiCreateLabel(50,325,144,37,"Your Age",false,winrss) guiLabelSetColor(lab7,0,255,0) guiLabelSetColor(lab8,0,255,0) guiLabelSetColor(lab9,0,255,0) guiLabelSetColor(lab10,0,255,0) guiLabelSetColor(lab11,0,255,0) guiLabelSetColor(lab12,0,255,0) img1=guiCreateStaticImage( 250, 200, 200, 200, "img/i2.png", false,winrss ) addEventHandler ( "onClientGUIClick", but1ss, closeShowStats, false ) end end addEvent( "onShowStats", true ) addEventHandler( "onShowStats", getRootElement(), showStats) function closeShowStats() destroyElement(winrss) showCursor(false) checkShowStats=0 end but i tested it with my friend , and when he pushed f1(i binded that for showing up window ) i saw his stats. When i pushed f1 he saw my stats. I want to modify this script to show stats only for player who requested that. Can someone help me? Thanks!
  3. still same , i put right values and still i see Wrong password or account name. my full client with gui for test: ------------------------- ------login window------- function logwindow() local w,s=guiGetScreenSize() showCursor(true) win = guiCreateWindow(w/2-100,-50,315,300,"Oli Login",false) edit = guiCreateEdit(77,75,144,37,"",false,win) edit2 = guiCreateEdit(77,147,144,36,"",false,win) label1 = guiCreateLabel(89,51,125,22,"Name:",false,win) label2 = guiCreateLabel(84,123,125,22,"Password:",false,win) but1 = guiCreateButton(60,235,81,34,"Register",false,win) but2 = guiCreateButton(147,236,81,34,"LogIN!",false,win) radio1 = guiCreateRadioButton(95,191,17,13,"",false,win) guiRadioButtonSetSelected(radio1,true) label3 = guiCreateLabel(112,189,108,18,"I accept rules (OR)",false,win) guiEditSetMasked ( edit2, true ) addEventHandler ( "onClientGUIClick", but2, getLoginData, false ) end addEventHandler("onClientResourceStart", root, logwindow) function getLoginData () local nick = guiGetText ( edit ) local pass = guiGetText ( edit2 ) local n=nick local p=pass local i=getPlayerName(localPlayer) triggerServerEvent("getLoginDataServer", localPlayer, n,p,i) outputChatBox("wyslalem") end function destroyLoginWindow() destroyElement(win) showCursor(false) end addEvent("loginapproved",true) addEventHandler("loginapproved", getRootElement(), destroyLoginWindow) edit: this script is working only when i got logged first by /login pass (build-in mta login system)
  4. Hi! I wanted to make my own login system so i created : client: function getLoginData (n,p,i) local imie = getPlayerName(getLocalPlayer()) local nick = guiGetText ( edit ) local pass = guiGetText ( edit2 ) n=nick p=pass i=imie triggerServerEvent("getLoginDataServer", getRootElement(), n,p,i) outputChatBox("wyslalem") end function destroyLoginWindow() destroyElement(win) showCursor(false) end addEvent("loginapproved",true) addEventHandler("loginapproved", getRootElement(), destroyLoginWindow) server: function logincheck(name,pass,imie) p=getPlayerFromName(imie) account=getPlayerAccount(p) pass_s=getAccountData(account,"player.pass") name_s=getAccountData(account,"player.nick") if name==name_s and pass==pass_s then outputChatBox("You logged in, welcome back "..imie.." ",p,0,255,0) triggerClientEvent("loginapproved",getRootElement()) else outputChatBox("Wrong password or account name!",p,255,0,0) end end addEvent("getLoginDataServer", true) addEventHandler("getLoginDataServer", getRootElement(), logincheck) but server still cant get player from nick(so its cant get data from account) , i tested this function by adding outputChatBox(imie) and its triggering good from client. Whats the problem?
  5. okay i did this function count(playerSource) time_spend=(time_spend)+1 stat=fileOpen(" "..playerz.."_stats.txt") read_time=fileRead(stat,500) done_time=gettok ( read_time ,1, string.byte(':') ) total_time=done_time+time_spend outputChatBox(""..total_time.."") fileWrite(stat,""..total_time..":secs") fileClose(stat) end and it save it as 123:secs124:secs124:secs...etc i want it to save only once like 124:secs then in next second 125:secs, not 123:secs124secs124secs
  6. Hello, i've got a problem with my script. i made a function which count total player time in server and export it to a file time_spend=0 function count(playerSource) time_spend=(time_spend)+1 stat=fileOpen(" "..playerz.."_stats.txt") read_time=fileRead(stat,500) total_spend_time=read_time+time_spend fileWrite(stat, ""..total_spend_time..":secs") fileClose(stat) end and a file with stats look:(this is example) 123:secs i want to get only number (123) from file , not string ":secs" . How to make it? help please!
  7. Working:) beer for you!
  8. I have problem with triggetServerEvent function, here's the code: client: otwarte=0 function guie() if otwarte == 0 then showCursor(true) otwarte=1 window = guiCreateWindow(500,169,271,360,"World Properties by Kuba ",false) label = guiCreateLabel(93,42,117,25,"Sky color",false,window) memo1= guiCreateMemo(9,70,59,32,"R",false,window) memo2 = guiCreateMemo(68,70,59,32,"G",false,window) memo3 = guiCreateMemo(127,70,59,32,"B",false,window) but1 = guiCreateButton(188,70,75,33,"Do it!",false,window) label2 = guiCreateLabel(86,112,88,26,"Water color",false,window) memo4 = guiCreateMemo(11,134,58,36,"R",false,window) memo5 = guiCreateMemo(69,134,58,36,"G",false,window) memo6 = guiCreateMemo(127,134,58,36,"B",false,window) but2 = guiCreateButton(190,137,70,33,"Do it!",false,window) label3 = guiCreateLabel(72,182,91,28,"Set time",false,window) memo7 = guiCreateMemo(40,200,58,36,"hours",false,window) memo8 = guiCreateMemo(98,200,58,36,"mins",false,window) but3 = guiCreateButton(190,207,70,33,"Do it!",false,window) but4 = guiCreateButton(12,260,82,32,"Allow car fly like airplanes",false,window) but5 = guiCreateButton(101,261,82,32,"Allow car drive on water",false,window) but6 = guiCreateButton(188,261,82,32,"Close window",false,window) but7 = guiCreateButton(12,310,82,32,"Disable flying cars",false,window) but8 = guiCreateButton(101,310,82,32,"Disable driving on water cars",false,window) but9 = guiCreateButton(188,310,82,32,"Save",false,window) addEventHandler("onClientGUIClick" ,but6, zamknij) addEventHandler("onClientGUIClick" ,but1, kolorn) addEventHandler("onClientGUIClick" ,but2, kolorw) addEventHandler("onClientGUIClick" ,but3, czas) addEventHandler("onClientGUIClick" ,but4, carf) addEventHandler("onClientGUIClick" ,but5, carw) addEventHandler("onClientGUIClick" ,but7, carfd) addEventHandler("onClientGUIClick" ,but8, carwd) addEventHandler("onClientGUIClick" ,but9, send) else outputChatBox("You opened already one window") end end bindKey("o","up",guie) function zamknij() otwarte=0 destroyElement(window) showCursor(false) end function kolorn() r=guiGetText(memo1) g=guiGetText(memo2) b=guiGetText(memo3) if r and g and b then setSkyGradient(r,g,b,r,g,b) else outputChatBox("Error creating sky color- try check r,g,b values") end end function kolorw() r1=guiGetText(memo4) g1=guiGetText(memo5) b1=guiGetText(memo6) if r1 and g1 and b1 then setWaterColor(r1,g1,b1) else outputChatBox("Error creating water color- try check r,g,b values") end end function czas() godz=guiGetText(memo7) minuta=guiGetText(memo8) if godz and minuta then setTime(godz,minuta) else outputChatBox("Error changing time") end end function carf() setWorldSpecialPropertyEnabled("aircars",true) end function carw() setWorldSpecialPropertyEnabled("hovercars",true) end function carfd() setWorldSpecialPropertyEnabled("aircars",false) end function carwd() setWorldSpecialPropertyEnabled("hovercars",false) end function send() rsky=tonumber(r) gsky=tonumber(g) bsky=tonumber(b) rwat=tonumber(r1) gwat=tonumber(g1) bwat=tonumber(b1) h1,m1=getTime() outputChatBox(""..rsky.."") triggerServerEvent ( "mojevent", getRootElement(), getLocalPlayer(), rsky,gsky,bsky,rwat,gwat,bwat,h1,m1) end server: function pobieranie(rsky,gsky,bsky,rwat,bwat,gwat,h1,m1) r3=rsky outputChatBox(" "..r3.." ") end addEvent ( "mojevent", true ) addEventHandler ( "mojevent", getRootElement(), pobieranie ) so when i click save in my gui script show me in client side rsky(R-color of skycolor)but in server show me error : " attempt to concatenate global 'r3' (a userdata value)". How to fix that? I want to get rsky value from client to server.
  9. Yeah but u dont get it what i wanted to do. I want that if some player(refree) write command /vs name1 name2 it will show name of players for everyone in server, i wanted to make something like " name1 vs name2"(for race gamemode)
  10. still wrong argument @dxDrawText.
  11. kuba90pl

    Script Help

    How to put to client side script(dxDrawText),player name from server side script? server: function komendavs(sourceplayer,commandName,nazwa1) player1=getPlayerFromName(nazwa1) car1 = getPedOccupiedVehicle(player1) setElementPosition(car1,0,0,0) name1=getPlayerName(player1) nick1=tostring(name1) outputChatBox(" "..nick1.." " ) callClientFunction(source,imie1,nick1) addCommandHandler("vs",komendavs) end client: function imie1( ) dxDrawText( nick1, dlug/2-dlug/4.8+dlug/11.52,wys/2-wys/3+wys/35,dlug,wys, tocolor ( 255, 255, 255, 255 ), 1.8, "clear" ) end i tried callClientFunction(source,imie1,nick1) but there is still error with wrong argument. Help!
×
×
  • Create New...