[Include] C-MYSQL (Remade) - Increased Speed & More Simple
#21

Ye but what change in SA:MP??
Reply
#22

Quick Inquiry,

It seems that in your example script
you have the public function OnQueryFinish

It also seems that when I try to compile your example script (all bugs removed)
I cannot fix the following:

pawn Код:
(61) : error 017: undefined symbol "playerid"
(62) : error 017: undefined symbol "playerid"
Error lines marked:

pawn Код:
#include <a_samp>
#include <a_mysql>
#include <zcmd>
#include <sscanf2>
#include <C-MySQL>

new MyMoney[MAX_PLAYERS], MyKills[MAX_PLAYERS];

stock GetUserName(playerid) {
      new name[24];
      GetPlayerName(playerid, name, 24); return name;
}

CMD:register(playerid, params[]) {
      if(CMySQL_Exists(GetUserName(playerid)))
           return SendClientMessage(playerid, 0xFFFFFFA, "<> Your account exists already!");

      new password[32];
      if(sscanf(params, "s[32]", password))
           return SendClientMessage(playerid, 0xFFFFFFA, "<> /register <password>");

      if(strlen(password) > 32)
           return SendClientMessage(playerid, 0xFFFFFFA, "<> Your password must be 32 characters or less.");

      CMySQL_Create(GetUserName(playerid), password);
}

CMD:login(playerid, params[]) {
       if(!CMySQL_Exists(GetUserName(playerid)))
           return SendClientMessage(playerid, 0xFFFFFFA, "<> Your account doesn't exist!");

      new password[32];
      if(sscanf(params, "s[32]", password))
           return SendClientMessage(playerid, 0xFFFFFFA, "<> /login <password>");

      if(strlen(password) > 32)
           return SendClientMessage(playerid, 0xFFFFFFA, "<> Your password must be 32 characters or less.");

      new Passwordz[32];
      CMySQL_Get(GetUserName(playerid), "Password", Passwordz, true);
      if(!strcmp(Passwordz, password, true)) {
           SendClientMessage(playerid, 0xFFFFFFA, "<> You're now logged.");
           CMySQL_Load(GetUserName(playerid), 1, playerid);
      }
}

stock GetMyAdminLevel(Username[]) {
     return CMySQL_Int(Username, "AdminLevel");
}

public OnPlayerDisconnect(playerid, reason) {
       new string[128];
       format(string, 128, "Money = %i, MyKills = %i", GetPlayerMoney(playerid), GetPlayerScore(playerid));
       CMySQL_CustomDataSet(GetUserName(playerid), string);
}

public OnQueryFinish( query[], resultid, extraid, connectionHandle ) {
      mysql_store_result();
      new Data[128];
      mysql_fetch_row_format(Data, "|");
-->      sscanf(Data, "p<|>ii", MyMoney[playerid], MyKills[playerid]);
-->      GivePlayerMoney(playerid, MyMoney[playerid]);
}
I could fix it, but I don't know how safe that would be,
any info on this?
Reply
#23

pawn Код:
public OnQueryFinish( query[], resultid, extraid, connectionHandle ) {
      mysql_store_result();
      new Data[128];
      mysql_fetch_row_format(Data, "|");
      sscanf(Data, "p<|>ii", MyMoney[extraid], MyKills[extraid]);
      GivePlayerMoney(playerid, MyMoney[extraid]);
}
Reply
#24

Scratch this post, (FAIL).
Reply
#25

Nice work, just crazy
Reply
#26

I think CMySQL_Float is bugged. It can't read find the field.

Shouldn't there be
pawn Код:
format(SQLEscapeX[5], 128, "SELECT %s FROM %s WHERE %s = '%s'", SQLEscapeX[3], SQLEscapeX[0], SQLEscapeX[1], SQLEscapeX[2]);
instead of
pawn Код:
format(SQLEscapeX[5], 128, "SELECT %s FROM %s WHERE %s = '%s'", SQLEscapeX[1], SQLEscapeX[0], SQLEscapeX[1], SQLEscapeX[2]);
Reply
#27

Quote:
Originally Posted by Double-O-Seven
Посмотреть сообщение
I think CMySQL_Float is bugged. It can't read find the field.

Shouldn't there be
pawn Код:
format(SQLEscapeX[5], 128, "SELECT %s FROM %s WHERE %s = '%s'", SQLEscapeX[3], SQLEscapeX[0], SQLEscapeX[1], SQLEscapeX[2]);
instead of
pawn Код:
format(SQLEscapeX[5], 128, "SELECT %s FROM %s WHERE %s = '%s'", SQLEscapeX[1], SQLEscapeX[0], SQLEscapeX[1], SQLEscapeX[2]);
CMySQL_Float uses mysql_fetch_field_row (BlueG's plugin). So it would fetch the float value.
Reply
#28

I mean SQLEscapeX[3] as first parameter instead of SQLEscapeX[1]...
Reply
#29

Quote:
Originally Posted by Double-O-Seven
Посмотреть сообщение
I mean SQLEscapeX[3] as first parameter instead of SQLEscapeX[1]...
I know what you mean, but look at the way I did CMySQL_Float. If I just put a random value into the SELECT <Value>, instead of Selecting all it would be faster. But, you're right it could be SQLEscapeX[3]. But it didn't matter when I used it.
Reply
#30

May I suggest you look up the "#tryinclude" directive in pawn-lang.pdf - it will get rid of one level of configuration by auto-detecting which MySQL include a user has.
Reply
#31

Quote:
Originally Posted by Toni
Посмотреть сообщение
This isn't the C-SMF thread >_>
I swear to God my computer is playing a game with me...!
Reply
#32

Sorry for the bump; but where do I specify the server, username and database?
Reply
#33

Sorry for the bump, but is this still suggested to use?
Reply
#34

Quote:
Originally Posted by Darnell
Посмотреть сообщение
Sorry for the bump, but is this still suggested to use?
Was it ever?
Reply
#35

Quote:
Originally Posted by Y_Less
Посмотреть сообщение
Was it ever?
That's why I am asking.
Reply
#36

---------
Reply
#37

Hi guys, anyone still have download link? Because i dont see any.
Reply
#38

Quote:
Originally Posted by ReVson
Посмотреть сообщение
Hi guys, anyone still have download link? Because i dont see any.
Still attached to a corrupted/non-existing image.
http://solidfiles.com/d/8fbd/download
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)