Jump to content
  • 0

Compare sql informations


Noturn

Question


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  38
  • Reputation:   1
  • Joined:  11/18/13
  • Last Seen:  

Hello everyone, I have one doubt about sql comparisons...

So, I have one custon table like this:

 

query_sql "insert into `char_info` (`account_id`, `char_id`, `name`) values ('"+ getcharid(3) +"', '"+ getcharid(0) +"', '" + strcharinfo(0) + "')";

 

 

How can I know if the char_id on custom table is the same of who is using the script? How can I compare this two things?

Thanks.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  


..... WHERE `char_id` = "+getcharid(0)+" ........

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  88
  • Reputation:   10
  • Joined:  01/15/16
  • Last Seen:  

Its done using a select and putting a WHERE like the one that Emistry do, but i really dont understand why you did this custom table, because al the information that you put there you can have it instantly in any script whitout doing a sql query, with the strcharinfo and getcharid that you just doed to put that information in the table...

in any case, if you put another thing i might understand... 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  38
  • Reputation:   1
  • Joined:  11/18/13
  • Last Seen:  

Its done using a select and putting a WHERE like the one that Emistry do, but i really dont understand why you did this custom table, because al the information that you put there you can have it instantly in any script whitout doing a sql query, with the strcharinfo and getcharid that you just doed to put that information in the table...

in any case, if you put another thing i might understand... 

Well, it's because I'm trying to do @kick command on label OnPCDieEvent, but the big problem here is that it have to happend even if the player is in autotrade mode (out of the game).

 
So, I thought that maybe if I save the char information on sql it can work. I really need help with this, so if you can help me.
 
 

 

 

..... WHERE `char_id` = "+getcharid(0)+" ........

 

 

I did this:

 

if (query_sql "SELECT `char_id` FROM `char_info` WHERE `char_id` = "+getcharid(0)+""))

 

but doesn't work at all, I have tried a lot of combinations, but really doesn't work.

 

 

 

My label is like this:

 

OnPCDieEvent:

 

if (query_sql "SELECT `char_id` FROM `char_info` WHERE `char_id` = "+getcharid(0)+"")){                           //It will be true just if had found player data on sql table right?

atcommand "@kick "+getcharid(0);

}

end;

 

 

@EDIT

 

It's working, thanks guys. Source modification was needed :D.

Edited by Noturn
Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

it doesnt need src mod to compare in SQL query.

 

if i recall correctly, @kick should only work for char name, and not char id ?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  38
  • Reputation:   1
  • Joined:  11/18/13
  • Last Seen:  

it doesnt need src mod to compare in SQL query.

 

if i recall correctly, @kick should only work for char name, and not char id ?

 

Work for both char name and char ID, i did src modification on my custom command, cause a realize that I actually don't need sql script.

 

Thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...