Sscanf help (/STATS COMMAND)
#1

pawn Код:
CMD:stats(playerid,params[])
{
    new target, sString1[90], sString2[90], sString3[90];
    if(sscanf(params, "u", target))
    {
        format(sString1, sizeof(sString1), "______ [%d]%s's statstics ________ " playerid, PlayerName(playerid) );
        format(sString2, sizeof(sString2), "Name: %s  Kills: %d  Deaths: %d  Money: %d Rank: %d " PlayerName(playerid), PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths], PlayerInfo[playerid][Money], PlayerInfo[playerid][Rank]);
        format(sString2, sizeof(sString3), "Donor rank: %d  Achievements: %d  Admin level: %d ", PlayerInfo[playerid][DRank], PlayerInfo[playerid][Achievements], PlayerInfo[playerid][AdminLevel]);
        SendClientMessage(playerid, GREEN, sString1);
        SendClientMessage(playerid, GREEN, sString2);
        SendClientMessage(playerid, GREEN, sString3);
    }
   
    else
    {
        format(sString1, sizeof(sString1), "______ [%d]%s's statstics ________ " target, PlayerName(target));
        format(sString2, sizeof(sString2), "Name: %s  Kills: %d  Deaths: %d  Money: %d Rank: %d " PlayerName(target), PlayerInfo[target][Kills], PlayerInfo[target][Deaths], PlayerInfo[target][Money], PlayerInfo[target][Rank]);
        format(sString2, sizeof(sString3), "Donor rank: %d  Achievements: %d  Admin level: %d ", PlayerInfo[target][DRank], PlayerInfo[target][Achievements], PlayerInfo[target][AdminLevel]);
        SendClientMessage(playerid, GREEN, sString1);
        SendClientMessage(playerid, GREEN, sString2);
        SendClientMessage(playerid, GREEN, sString3);
    }
    return 1;
}
Код:
C:\Users\Storage\Desktop\Scripting set\gamemodes\CS.pwn(752) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\Storage\Desktop\Scripting set\gamemodes\CS.pwn(752) : warning 215: expression has no effect
C:\Users\Storage\Desktop\Scripting set\gamemodes\CS.pwn(752) : error 001: expected token: ";", but found ")"
C:\Users\Storage\Desktop\Scripting set\gamemodes\CS.pwn(752) : error 029: invalid expression, assumed zero
C:\Users\Storage\Desktop\Scripting set\gamemodes\CS.pwn(752) : fatal error 107: too many error messages on one line
Line 752:
pawn Код:
if(sscanf(params, "u", target))
Reply
#2

pawn Код:
CMD:stats(playerid, params[])
{
    new target, sString1[90], sString2[90], sString3[90];
    if(sscanf(params, "u", target))
    {
        format(sString1, sizeof(sString1), "______ [%d]%s's statstics ________ ", playerid, PlayerName(playerid) );
        format(sString2, sizeof(sString2), "Name: %s  Kills: %d  Deaths: %d  Money: %d Rank: %d ", PlayerName(playerid), PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths], PlayerInfo[playerid][Money], PlayerInfo[playerid][Rank]);
        format(sString2, sizeof(sString3), "Donor rank: %d  Achievements: %d  Admin level: %d ", PlayerInfo[playerid][DRank], PlayerInfo[playerid][Achievements], PlayerInfo[playerid][AdminLevel]);
        SendClientMessage(playerid, GREEN, sString1);
        SendClientMessage(playerid, GREEN, sString2);
        SendClientMessage(playerid, GREEN, sString3);
    }
   
    else
    {
        format(sString1, sizeof(sString1), "______ [%d]%s's statstics ________ ", target, PlayerName(target));
        format(sString2, sizeof(sString2), "Name: %s  Kills: %d  Deaths: %d  Money: %d Rank: %d ", PlayerName(target), PlayerInfo[target][Kills], PlayerInfo[target][Deaths], PlayerInfo[target][Money], PlayerInfo[target][Rank]);
        format(sString2, sizeof(sString3), "Donor rank: %d  Achievements: %d  Admin level: %d ", PlayerInfo[target][DRank], PlayerInfo[target][Achievements], PlayerInfo[target][AdminLevel]);
        SendClientMessage(playerid, GREEN, sString1);
        SendClientMessage(playerid, GREEN, sString2);
        SendClientMessage(playerid, GREEN, sString3);
    }
    return 1;
}
You have forgotten some commas..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)