Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

sscanf warning: Strings without a length are deprecated, please add a destination size.

$
0
0
Code:

COMMAND:ticket(playerid, params[])
{
        new targetid,string[128], amount, reason[50];
        if(sscanf(params, "uds", targetid, amount, reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /ticket [playerid] [amount] [reason]");
    if (GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");
        //if (playerid == targetid) return SendClientMessage(playerid, COLOR_GREY, "You cannot ticket yourself.");
    if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "This player is not connected!");
        if(GetPVarInt(playerid, "Member") != 1) return nal(playerid);
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        if(!IsPlayerInRangeOfPoint(targetid, 10.0, X, Y, Z)) return error(playerid, "This player is not nearby you.");
        if(amount < 25 || amount > 2000) return SendClientMessage(playerid, COLOR_GREY, "Cannot go under 25 or above 2000.");
        new query[516], year, month, day, hour, minute, second;
        getdate(year, month, day);
        gettime(hour,minute,second);
        new datum[64], timel[64];
        format(timel, sizeof(timel), "%d:%d:%d", hour, minute, second);
        format(datum, sizeof(datum), "%d-%d-%d", year, month, day);
        format(query, sizeof(query), "INSERT INTO `tickets`(`player`, `officer`, `time`, `date`, `amount`, `reason`) VALUES ('%s','%s','%s','%s',%d,'%s')",
    PlayerName(targetid), PlayerName(playerid),
        timel,datum, amount,reason);
        mysql_tquery(handlesql, query);
        format(string, sizeof(string), "* %s writes a ticket of $%d to %s", PlayerName(playerid), amount, PlayerName(targetid));
        ProxDetector(30.0, playerid, string, COLOR_PURPLE);
        return 1;
}

Is there something wrong with this code here?;

Code:

if(sscanf(params, "uds", targetid, amount, reason))
Help would be appreciated thank you.

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>