GPCI insert problem.
#1

I have this problem with gpci. When a player connects / creates an account the server sees the gpci as it should. But when I use /ban and I try to insert the serial into the bans table it inserts a wrong serial. Look here :

pawn Код:
[02:15:24] [join] Jack_Saunders has joined the server (2:188.27.113.124)
[02:15:30] SELECT * FROM `bans` WHERE `playerSerial` = '4945DECED9CAE99DC5E9449E00898D8DCEAD5CD4' AND `playerIP` LIKE '188.27.' LIMIT 1
[02:15:40] INSERT INTO `bans` (name, reason, playerIP, playerSerial) VALUES ('Jack_Saunders', 'test', '188.27.113.124', '8004545A0844D408FF9C40EFDEA4444EC8DA889D')
Users : E8E048AD4F4D4F494488AE94D9E40CEA4DFA4DD4
Bans : 8004545A0844D408FF9C40EFDEA4444EC8DA889D

These 2 are from the same user. The table design is the same.


Ban command :

pawn Код:
CMD:ban(playerid, params[])
{
    if(!CheckAdmin(playerid, ADMIN_LEVEL_1)) return NotAuthMSG(playerid);
    new id, reason[128];
    new playerserial[128];
    gpci(playerid,playerserial,sizeof(playerserial));
    if(sscanf(params,"us[128]",id,reason)) return SyntaxMSG(playerid, "/ban [playerid/PartOfName] [motiv]");
    if(!PlayerIsOn(id)) return NotConnectedMSG(playerid);
    format(msg, sizeof(msg), "AdmCmd: %s a fost banat de catre %s. Motiv: %s.", GetName(id), GetName(playerid), reason);
    format(query, sizeof(query), "INSERT INTO `bans` (name, reason, playerIP, playerSerial) VALUES ('%s', '%s', '%s', '%s')", GetName(id),reason, GetPlayerIP(id), playerserial);
    mysql_function_query(dbHandle, query, true, "BanWithMSGEx", "iss", id, msg, reason);
    printf(query);
    return 1;
}
Table designs in mysql are the same. So there's no reason why it doesn't work... Anyone has any ideas?
Reply
#2

I do all of that,my problem is that it inserts the wrong ID. Look at the ban command and tell me if there's anything wrong with it.
Reply
#3

OMG ! Sometimes I'm the biggest moron on the face of the planet =) . I've been hitting my head agaist the wall for two days with this and I was like "Why the hell doesn't it work?!" when actually it was that simple...

THANK YOU ! I'll try to +rep you man .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)