MAB Posted February 15, 2016 Share Posted February 15, 2016 How to create a chat channel? How to set settings for my resources? Can i get an example of SQL codes that saves the name color or something? I know SQL but never used it with MTA. Link to comment
tosfera Posted February 16, 2016 Share Posted February 16, 2016 How to create a chat channel? tables, loops, outputChatBox, bindkey/addCommandHandler. How to set settings for my resourced What kind of settings? Can i get an example of SQL codes that saves the name color or something? MTA uses the same SQL as mariaDB systems ( phpmyadmin ), so it's basically the same. Either use the db* functions from the wiki or install the MySQL plugin. Link to comment
MAB Posted February 16, 2016 Author Share Posted February 16, 2016 tables, loops, outputChatBox, bindkey/addCommandHandler. yea yea i need an example.. What kind of settings? doesn't matter MTA uses the same SQL as mariaDB systems ( phpmyadmin ), so it's basically the same. Either use the db* functions from the wiki or install the MySQL plugin. example?? Link to comment
KariiiM Posted February 16, 2016 Share Posted February 16, 2016 example?? There are alot of examples at the wiki, check the link in below. Click_Here! Link to comment
MAB Posted February 19, 2016 Author Share Posted February 19, 2016 example?? There are alot of examples at the wiki, check the link in below. Click_Here! If i understood it, what i am doing here? wasting time? Link to comment
tosfera Posted February 19, 2016 Share Posted February 19, 2016 example?? There are alot of examples at the wiki, check the link in below. Click_Here! If i understood it, what i am doing here? wasting time? Basically, we're answering your questions. This part of the forum is for support in scripts you made. Not to request things. If you're just requesting examples, yes. You're wasting your time. Link to comment
MAB Posted February 19, 2016 Author Share Posted February 19, 2016 (edited) .. Edited February 20, 2016 by Guest Link to comment
tosfera Posted February 19, 2016 Share Posted February 19, 2016 Listen, you started to annoy me. Got answer put it on, don't have then keep silence. All you do is wasting time and giving no useful :~ at the end. I've given the answers, you asked how to do something, I told you what kind of functions you would need. No way that I'm one out of the 10 losers on this forum which is seriously just giving out scripts to people who keep requesting it and not getting proper credits for it. It's a forum to support you when your script is being a total b!tch, not a thing where you can randomly ask around to get sh*t done without moving your lazy fat ass. Link to comment
MAB Posted February 19, 2016 Author Share Posted February 19, 2016 (edited) .. Edited February 20, 2016 by Guest Link to comment
Bonus Posted February 20, 2016 Share Posted February 20, 2016 How about giving informations about WHAT YOU DON'T UNDERSTAND. I learned everything by trying and looking into MTA Wiki, it's not hard. Why would someone explain the same **** again if it's already in the wiki?! Link to comment
MAB Posted February 20, 2016 Author Share Posted February 20, 2016 What i don't understand is why there are dbFree and dbPoll don't SELECT return it already? Example: m = dbQuery(connection,"SELECT x,y,z.....) can i do now: setElementPosition(element,m[1],m[2],m[3]) Link to comment
Noki Posted February 20, 2016 Share Posted February 20, 2016 What i don't understand is why there are dbFree and dbPoll don't SELECT return it already? Example: m = dbQuery(connection,"SELECT x,y,z.....) can i do now: setElementPosition(element,m[1],m[2],m[3]) dbQuery returns a query handler element, which is useless unless used with dbPoll, which returns a table, or dbFree, which returns a boolean and clears the query from memory. So, something like... qh = dbQuery("SELECT x, y, z FROM coords") result = dbPoll(qh, -1) if (result and #result > 0) then setElementPosition(element, result[1].x, result[1].y, result[1].z) end Link to comment
tosfera Posted February 20, 2016 Share Posted February 20, 2016 What i don't understand is why there are dbFree and dbPoll don't SELECT return it already? Example: m = dbQuery(connection,"SELECT x,y,z.....) can i do now: setElementPosition(element,m[1],m[2],m[3]) As the wiki states; Use the returned query handle with dbPoll to get the result, or dbFree if you don't want the result. Use dbPoll for select queries to get your result. Once you got your result loaded into variables, you can use those to get your data into functions. Link to comment
MAB Posted February 20, 2016 Author Share Posted February 20, 2016 Any example of chat channel? Link to comment
tosfera Posted February 20, 2016 Share Posted February 20, 2016 Any example of chat channel? create a new table ( you should know how to do this, if not use the spoiler ) Pff, did you even try? local channels = { ]; After that, allow users to chat in those channels by either loading their nickname in there, or username, or id, or what ever the hell you want. Add a new command that allows them to switch to channels, create their channel or what so ever. Once they used the command, load their specific data into the table, or just their character. After they joined a channel, using a command to talk will output a message to all the users which are in that channel. A quick tiny example would be; local channels = { }; addCommandHandler ( "joinChannel", function ( thePlayer, _, channel ) if ( channel ) then if not ( channels [ channel ] ) then channels [ channel ] = { }; outputChatBox ( "Creating a new channel with the name: ".. channel, thePlayer ); end table.insert ( channels [ channel ], thePlayer ); setElementData ( thePlayer, "channel", channel ); else outputChatBox ( "Please provide us a channelname.", thePlayer ); end end ); addCommandHandler ( "cc", function ( thePlayer, _, ... ) local channel = getElementData ( thePlayer, "channel" ); if ( channels [ channel ] ) then if ( channels [ channel ] [ thePlayer ] ) then for i = 1, #channels [ channel ] do if ( not isElement ( channels [ channel ] [ i ] ) ) then channels [ channel ] [ i ] = nil; else outputChatBox ( "[".. channel .."] ".. getPlayerName ( thePlayer )..": ".. table.concat ( {...}, " " ), channels [ channel ] [ i ] ); end end end end end ); Link to comment
MAB Posted February 20, 2016 Author Share Posted February 20, 2016 Any example of chat channel? create a new table ( you should know how to do this, if not use the spoiler ) Pff, did you even try? local channels = { ]; After that, allow users to chat in those channels by either loading their nickname in there, or username, or id, or what ever the hell you want. Add a new command that allows them to switch to channels, create their channel or what so ever. Once they used the command, load their specific data into the table, or just their character. After they joined a channel, using a command to talk will output a message to all the users which are in that channel. A quick tiny example would be; local channels = { }; addCommandHandler ( "joinChannel", function ( thePlayer, _, channel ) if ( channel ) then if not ( channels [ channel ] ) then channels [ channel ] = { }; outputChatBox ( "Creating a new channel with the name: ".. channel, thePlayer ); end table.insert ( channels [ channel ], thePlayer ); setElementData ( thePlayer, "channel", channel ); else outputChatBox ( "Please provide us a channelname.", thePlayer ); end end ); addCommandHandler ( "cc", function ( thePlayer, _, ... ) local channel = getElementData ( thePlayer, "channel" ); if ( channels [ channel ] ) then if ( channels [ channel ] [ thePlayer ] ) then for i = 1, #channels [ channel ] do if ( not isElement ( channels [ channel ] [ i ] ) ) then channels [ channel ] [ i ] = nil; else outputChatBox ( "[".. channel .."] ".. getPlayerName ( thePlayer )..": ".. table.concat ( {...}, " " ), channels [ channel ] [ i ] ); end end end end end ); You think i can't do this? I am looking for the chat channels that looks like the main chat one like in SAUR. Link to comment
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