IP [+REP]
#7

We will not script for you, but we will point you in the right direction so you can do it yourself. Firstly you have to understand what you have to do, so this is an interesting tutorial on ZCMD and sscanf: https://sampforum.blast.hk/showthread.php?tid=280476
Don't be lazy and read it from top to bottom. At the end of it, I'm pretty sure that you'll know how to create commands and maybe even more.
Your "script" will look like this:
pawn Код:
forward <your_IP_check_function>;
public <same_function>
{
    //if there are any rows found, go further
    //load the data from the cache
    //use the loaded data
    return 1;
}

CMD:<command_name>(playerid, params[])
{
    //processing the parameters
    //sending the query to sql
    return 1;
}
The ZCMD and sscanf are explained there, in the tutorial that I linked you. For the SQL part, here are the functions you need to know:
- https://sampwiki.blast.hk/wiki/MySQL/R33#mysql_connect - connecting to your SQL database
- https://sampwiki.blast.hk/wiki/MySQL/R33#mysql_tquery - sending the query to sql
- https://sampwiki.blast.hk/wiki/MySQL/R33..._get_row_count or https://sampwiki.blast.hk/wiki/MySQL/R33#cache_get_data - checking if the query produced some results
- https://sampwiki.blast.hk/wiki/MySQL/R33#cache_get_row or https://sampwiki.blast.hk/wiki/MySQL/R33#cache_get_row_int or https://sampwiki.blast.hk/wiki/MySQL/R33..._get_row_float - loading data from cache to local/global variables

These are the pieces of the puzzle, put them together and not only that you'll understand how ZCMD, sscanf and sql works, but you'll also be able to build awesome scripts on your own, using your imagination.
Reply


Messages In This Thread
IP [+REP] - by arlindi - 27.02.2015, 16:58
Re: IP [+REP] - by HazardouS - 27.02.2015, 18:04
Re: IP [+REP] - by arlindi - 27.02.2015, 18:51
Re: IP [+REP] - by arlindi - 27.02.2015, 21:26
Re: IP [+REP] - by DanishHaq - 27.02.2015, 21:32
Re: IP [+REP] - by arlindi - 27.02.2015, 21:35
Re: IP [+REP] - by HazardouS - 27.02.2015, 22:24
Re: IP [+REP] - by arlindi - 27.02.2015, 22:27
Re: IP [+REP] - by DanishHaq - 27.02.2015, 23:06

Forum Jump:


Users browsing this thread: 1 Guest(s)