Strcmp help
#1

pawn Код:
if(!strcmp(cmdtext, "/minfps", true, 7))
    {
        if(!cmdtext[7])return SendClientMessage(playerid, COLOR_ERROR, "ERROR: /minfps [20-50]");
        new str[200];
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
        format(str, sizeof(str), "** %s has set the minimum FPS limit to: %i", playername, cmdtext[8]);
        SendClientMessageToAll(COLOR_MESSAGE, str);
        MIN_FPS = cmdtext[8];
        return 1;
    }
pawn Код:
if(pFPS[playerid] < MIN_FPS)
    {
        Kick(playerid);
    }
This command doesn't seem to work. I want it to do such as: /minfps 40 and it will kick a player with FPS below 40 but can't find a solution. Any help?
Reply
#2

some sscanf will do
Reply
#3

Are you here to help me or boost your post count?
Reply
#4

sorry,

https://sampforum.blast.hk/showthread.php?tid=120356
https://sampwiki.blast.hk/wiki/Fast_Commands#sscanf

it's a mighty big thread, but you're a big boy, you'll get through..
Reply
#5

pawn Код:
if (!strcmp(cmdtext, "/minfps", true, 7))
{
    new fps_amount;
    if (sscanf(cmdtext[8], "i", fps_amount)) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: /minfps [20-50]");
    new str[62], playername[21];
    GetPlayerName(playerid, playername, sizeof (playername));
    format(str, sizeof (str), "** %s has set the minimum FPS limit to: %i", playername, fps_amount);
    SendClientMessageToAll(COLOR_MESSAGE, str);
    MIN_FPS = fps_amount;
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)