SA-MP Forums Archive
Phone - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Phone (/showthread.php?tid=204973)



Phone - Rokzlive - 30.12.2010

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.


Re: Phone - Rokzlive - 31.12.2010

Anyone?


Re: Phone - _rAped - 31.12.2010

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


Re: Phone - veyron - 31.12.2010

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;
}