MYSQL r38 saving string...
#1

So I need some help with gettime saving string in mysql...

here is what I dont know how to put it...

ENUM:

pawn Код:
enum PDATA //We name our enumerator as PDATA (which stands for PlayerDATA). You can name it however you want.
{
    pBANNED,
    pBANNEDfor[20], // The reason for being banned?
    pBANNEDby[MAX_PLAYER_NAME], // The ADMIN who banned this player
    pBANNEDtime, // the timestamp of being banned. Not necessary but useful for showing stuff.
    pUNBANtime
}
And here is where I need to check it..

pawn Код:
public OnAccountLoad(playerid)
{
    pInfo[playerid][Admin] = cache_get_field_content_int(0, "Admin"); //we're getting a field 4 from row 0. And since it's an integer, we use cache_get_row_int
    pInfo[playerid][VIP] = cache_get_field_content_int(0, "VIP"); //Above
    pInfo[playerid][Money] = cache_get_field_content_int(0, "Money");//Above
    pInfo[playerid][posX] = cache_get_field_content_float(0, "PosX");//Above. Since player's position is a float, we use cache_get_field_content_float
    pInfo[playerid][posY] = cache_get_field_content_float(0, "PosY");//Above
    pInfo[playerid][posZ] = cache_get_field_content_float(0, "PosZ");//Above
    pInfo[playerid][pBANNEDfor] = cache_get_row(0, "pBANNEDfor");//THIS ONE!!!
    pInfo[playerid][pBANNEDby] = cache_get_row(0, "pBANNEDby");//THIS ONE!!!!
    pInfo[playerid][pUNBANtime] = cache_get_field_content_int(0, "pUNBANtime");
    pInfo[playerid][pBANNEDtime] = cache_get_field_content_int(0, "pBANNEDtime");
    pInfo[playerid][pBANNED] = cache_get_field_content_int(0, "pBANNED");
    GivePlayerMoney(playerid, pInfo[playerid][Money]);
    SendClientMessage(playerid, -1, "Successfully logged in"); //tell them that they have successfully logged in
    return 1;
}
With best regards Scrillex..
Reply
#2

Use cache_get_field_content function instead,
pawn Код:
public OnAccountLoad(playerid)
{
    pInfo[playerid][Admin] = cache_get_field_content_int(0, "Admin"); //we're getting a field 4 from row 0. And since it's an integer, we use cache_get_row_int
    pInfo[playerid][VIP] = cache_get_field_content_int(0, "VIP"); //Above
    pInfo[playerid][Money] = cache_get_field_content_int(0, "Money");//Above
    pInfo[playerid][posX] = cache_get_field_content_float(0, "PosX");//Above. Since player's position is a float, we use cache_get_field_content_float
    pInfo[playerid][posY] = cache_get_field_content_float(0, "PosY");//Above
    pInfo[playerid][posZ] = cache_get_field_content_float(0, "PosZ");//Above
    cache_get_field_content(0,"pBANNEDfor",pInfo[playerid][pBANNEDfor],max_length);//change the max_length thing!
    cache_get_field_content(0,"pBANNEDby",pInfo[playerid][pBANNEDby],max_length);
    pInfo[playerid][pUNBANtime] = cache_get_field_content_int(0, "pUNBANtime");
    pInfo[playerid][pBANNEDtime] = cache_get_field_content_int(0, "pBANNEDtime");
    pInfo[playerid][pBANNED] = cache_get_field_content_int(0, "pBANNED");
    GivePlayerMoney(playerid, pInfo[playerid][Money]);
    SendClientMessage(playerid, -1, "Successfully logged in"); //tell them that they have successfully logged in
    return 1;
}
Source here!
Quote:

Important
Note
You have to provide the size (max_len) by yourself if you use an enum-array as destination.

Reply
#3

Added Max_Len
new name [25];

Error:
pawn Код:
error 035: argument type mismatch (argument 4)
error 035: argument type mismatch (argument 4)
Error lines:
pawn Код:
cache_get_field_content(0,"pBANNEDfor",pInfo[playerid][pBANNEDfor],name);//change the max_length thing!
cache_get_field_content(0,"pBANNEDby",pInfo[playerid][pBANNEDby],name);
Reply
#4

pawn Код:
cache_get_field_content(0, "pBANNEDfor", pInfo[playerid][pBANNEDfor], mysql, 129);
cache_get_field_content(0, "pBANNEDby", pInfo[playerid][pBANNEDby], mysql, 129);
Add Connection handle.
Reply
#5

No not like that, you should add these value in your enum.
pawn Код:
enum pInfo
{
    pBANNEDfor[64],
    pBANNEDby[24]
}
new pInfo[MAX_PLAYERS][pInfo];

public OnAccountLoad(playerid)
{
    pInfo[playerid][Admin] = cache_get_field_content_int(0, "Admin"); //we're getting a field 4 from row 0. And since it's an integer, we use cache_get_row_int
    pInfo[playerid][VIP] = cache_get_field_content_int(0, "VIP"); //Above
    pInfo[playerid][Money] = cache_get_field_content_int(0, "Money");//Above
    pInfo[playerid][posX] = cache_get_field_content_float(0, "PosX");//Above. Since player's position is a float, we use cache_get_field_content_float
    pInfo[playerid][posY] = cache_get_field_content_float(0, "PosY");//Above
    pInfo[playerid][posZ] = cache_get_field_content_float(0, "PosZ");//Above
    cache_get_field_content(0,"pBANNEDfor",pInfo[playerid][pBANNEDfor]);//now just ignore the max_length you already defined in your enum.
    cache_get_field_content(0,"pBANNEDby",pInfo[playerid][pBANNEDby]);
    pInfo[playerid][pUNBANtime] = cache_get_field_content_int(0, "pUNBANtime");
    pInfo[playerid][pBANNEDtime] = cache_get_field_content_int(0, "pBANNEDtime");
    pInfo[playerid][pBANNED] = cache_get_field_content_int(0, "pBANNED");
    GivePlayerMoney(playerid, pInfo[playerid][Money]);
    SendClientMessage(playerid, -1, "Successfully logged in"); //tell them that they have successfully logged in
    return 1;
}
Reply
#6

Cheers mate that done the thing
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)