sscanf -
Cassely1704 - 11.11.2013
I have a problem with sscanf, it's working wrong.
Код:
YCMD:spec(playerid, params[], help)
{
if(sscanf(params, "u", params[0])) return SendClientMessage(playerid, COLOR_WHITE, "TYPE: /spec [id/name]");
if(!IsPlayerConnected(params[0])) return SendClientMessage(playerid, COLOR_GREY, "The player isn't connected!");
etc.
}
Sometimes sscanf returns
Код:
SendClientMessage(playerid, COLOR_GREY, "The player isn't connected!");
However the player is on the server. What's happend? How can I fix that?
Thx before.
Re: sscanf -
Loot - 11.11.2013
I wouldn't use the native params for that, but:
pawn Код:
YCMD:spec(playerid, params[], help)
{
new iPlayer;
if(sscanf(params, "u", iPlayer)) return SendClientMessage(playerid, COLOR_WHITE, "TYPE: /spec [id/name]");
if(iPlayer == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "The player isn't connected!");
//etc.
}
Re: sscanf -
Cassely1704 - 11.11.2013
Where can I get plugin sscanf for Fedora? Maybe it's not working because I'm using plugin not for Fedora.
Re: sscanf -
Konstantinos - 11.11.2013
When it says an online player is not a valid player, it's due to the plugin's version. This happens with older versions, so update sscanf to the latest one.
https://sampforum.blast.hk/showthread.php?tid=120356
Re: sscanf -
Cassely1704 - 11.11.2013
Quote:
Originally Posted by Konstantinos
|
I used the latest version. The same shit.
Re: sscanf -
Konstantinos - 11.11.2013
I've heard that a lot of times and always either the plugin file or the include was not updated.
So use it as Loot said in his post and make sure again that the sscanf version is 2.8.1 (the sscanf2.inc too).
Re: sscanf -
Stinged - 11.11.2013
I think this sscanf plugin will work for you.
Click me
use sscanf like this:
pawn Код:
YCMD:spec(playerid, params[], help)
{
#pragma unused help
// Keep pragma unused help if you don't want to use the help thing y_commands have (or delete it if you do)
new id; // The ID you will enter after /spec
if(sscanf(params,"u",id)) SendClientMessage(playerid, -1, "Usage: /spec [id/name]");
else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000FF, "Player is not connected.");
else
{
// Do what you want here.
}
return 1;
}
Also, Read this, it tells you how sscanf works.
Click me
Re: sscanf -
Cassely1704 - 11.11.2013
Quote:
Originally Posted by Stinged
I think this sscanf plugin will work for you. Click me
use sscanf like this:
pawn Код:
YCMD:spec(playerid, params[], help) { #pragma unused help // Keep pragma unused help if you don't want to use the help thing y_commands have (or delete it if you do) new id; // The ID you will enter after /spec if(sscanf(params,"u",id)) SendClientMessage(playerid, -1, "Usage: /spec [id/name]"); else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000FF, "Player is not connected."); else { // Do what you want here. } return 1; }
Also, Read this, it tells you how sscanf works. Click me
|
I just did all commands like this but it still returns "Player isn't connected", plugin 2.8.1, include too.
Re: sscanf -
Cassely1704 - 12.11.2013
I use plugin 2.8.1, but somtimes sscanf doesn't find a player yet.
Help me please.
Re: sscanf -
Stinged - 13.11.2013
Well, it works perfectly for me.
Since I script basic stuff, I use zcmd, it's more... simple.
Try the code I posted but with zcmd (
Click me for link)
Note: Remove #pragma unused help when you try using zcmd.