#1

How do i make a callback to see if the the field "phone" in my "accounts" table for a certain player is set to 1 to have a phone? For example.

If the feild is 0

Player enters...
/call

They get back...
You dont have a phone! Buy one at the shop!


If the feild is 1

Player enters...
/call

Then the command i coded kicks in.

How would i do that?

And what would i use in the shop to set the field from 0 to 1 when they buy the phone?

I use striken kids mysql plugin.

Thankyou.
Reply
#2

Anyone?
Reply
#3

You got to store it in somekind of variable. Prefferably global stored with the rest of the playerdata.
Reply
#4

replace field/column names and it should work
pawn Код:
stock HasPhone(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        new Query[256],EscapedName[MAX_PLAYER_NAME],pName[MAX_PLAYER_NAME],hasphone;
        GetPlayerName(playerid,pName,sizeof(pName));
        mysql_real_escape_string(pName, EscapedName);
        format(Query, sizeof(Query), "SELECT `Phone` FROM `players` WHERE `Name` = '%s'", EscapedName);
        mysql_query(Query);
        mysql_store_result();
        hasphone = mysql_fetch_int();
        mysql_free_result();
        return hasphone;
    }
    else print("[MySQL] HasPhone() was called, to non-connected ID.");
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)