/smokeweed crashing game
#1

Hey I made a simple weed system, does anyone know why when the player uses /smokeweed and has 0 weed, it says you have no weed... but then when the player does have weed (after an admin /agiveweed's the player), they use /smokeweed and it crashes the game. The server console says "sscanf warning: Format specifier does not match parameter count." This is my code
pawn Код:
CMD:agiveweed(playerid, params[])
{
    new targetid, string[128], amount;
    if(PlayerStat[playerid] [AdminLevel] < 2) return SendClientMessage(playerid, GREY, "You don't have access to this command!");
    if(sscanf(params, "ud[128]", targetid, amount)) return SendClientMessage(playerid, GREY, "USAGE: /agiveweed [playerid] [amount]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, GREY, "That player is not connected!");
    else
    {
        PlayerStat[targetid][HasWeed] = amount++;
        format(string, sizeof(string), "You have given %s %d gram(s) of weed!", GetOOCName(targetid), amount);
        SendClientMessage(playerid, WHITE, string);
        format(string, sizeof(string), "Administrator %s has given you %d gram(s) of weed!", GetOOCName(playerid), amount);
        SendClientMessage(targetid, WHITE, string);
        AdminActionLog(string);
    }
    return 1;
}


CMD:smokeweed(playerid, params[])
{
    new Float:health, string[128];
    if(PlayerStat[playerid][HasWeed] >= 1)
    {
        if(GetPlayerHealth(playerid, health) < 75)                
        {
            ApplyAnimation(playerid, "JST_BUSINESS", "smoke_01", 4.1, 1, 1, 1, 0, 1, 1);
            SetPlayerHealth(playerid, health+25);
            format(string, sizeof(string), "%s takes out a joint and smokes some weed.", GetICName(playerid));
            SendNearByMessage(playerid, ACTION_COLOR, string, 4);
            PlayerStat[playerid][HasWeed] -= 1;
        }
        else
        {
            SendClientMessage(playerid, GREY, "Your health must be below 75 to smoke weed!");
        }
    }
    else
    {
        SendClientMessage(playerid, GREY, "You don't have any weed left!");
    }
    return 1;
 }
I've got
pawn Код:
enum PlayerInfo
{
            HasWeed,
}
etc

Any help would be appreciated. Thank you!
Reply


Messages In This Thread
/smokeweed crashing game - by Josh_Main - 06.10.2014, 02:22
Re: /smokeweed crashing game - by Pottus - 06.10.2014, 02:28
Respuesta: /smokeweed crashing game - by !R1Ch@rD! - 06.10.2014, 02:33
Re: /smokeweed crashing game - by Josh_Main - 06.10.2014, 02:50
Re: /smokeweed crashing game - by Chenko - 06.10.2014, 03:06
Re: /smokeweed crashing game - by DavidBilla - 06.10.2014, 03:11

Forum Jump:


Users browsing this thread: 3 Guest(s)