Strcmp help - 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)
+--- Thread: Strcmp help (
/showthread.php?tid=498570)
Strcmp help -
(_AcE_) - 04.03.2014
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?
Re: Strcmp help -
Ada32 - 04.03.2014
some sscanf will do
Re: Strcmp help -
(_AcE_) - 04.03.2014
Are you here to help me or boost your post count?
Re: Strcmp help -
Ada32 - 04.03.2014
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..
Re: Strcmp help -
Konstantinos - 04.03.2014
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;
}