1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Mysql check

Discussion in 'Skript' started by helomi, May 14, 2017.

Thread Status:
Not open for further replies.
  1. helomi

    helomi Member

    Joined:
    Feb 9, 2017
    Messages:
    18
    Likes Received:
    0
    Hi, i try 2 hours create simple mysql row check, but dont work :/

    I tried something like this:
    Code (Text):
    1.  
    2. On join:
    3.    set {_check-%player%} to mysql result of query "SELECT Breaks_cobble FROM Stats_SB_Player WHERE 'Player' = '%player%'"
    4.    if {_check-%player%} is not "%player%":
    5.        ....
    6.  

    I need simple table check if player have row in table.
     
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    Code (Skript):
    1. function check(tbl: text, c: text, w: text) :: boolean:
    2.      set {_result} to mysql result of query "SELECT %{_c}% FROM %{_tbl}% %{_w}%"
    3.      set {_rc::*} to mysql object "%{_c}%" in {_result}
    4.      if {_rc::*} is not set:
    5.           set {_return} to false
    6.      else:
    7.           set {_return} to true
    8.      return {_return}
    Code (Skript):
    1. if check("tableName", "Player", "WHERE Player='%{_p}%'") is true:
    and get object
    Code (Skript):
    1. function get(tbl: text, c: text, w: text) :: objects:
    2.      set {_result} to mysql result of query "SELECT %{_c}% FROM %{_tbl}% %{_w}%"
    3.      set {_rt::*} to mysql object "%{_c}%" in {_result}
    4.      return {_rt::*}
     
    #2 ShaneBee, May 14, 2017
    Last edited by a moderator: May 14, 2017
Thread Status:
Not open for further replies.

Share This Page

Loading...