Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

sscanf bug?

$
0
0
I use sscanf for my votekick command

Quote:

CMD:votekick(playerid, params[])
{
new TargetName[MAX_PLAYER_NAME];
GetPlayerName(VotekickPlayerID, TargetName, sizeof( TargetName));
if(sscanf(params, "us[128]", VotekickPlayerID, VotekickReason))
{
SendClientMessage(playerid, -1, "[Error:] /votekick <id> <reason>");
}
Top of gamemode :

Quote:

new VotekickPlayerID;
new VotekickReason;
Whole /votekick cmd script :

Quote:

CMD:votekick(playerid, params[])
{
new TargetName[MAX_PLAYER_NAME];
GetPlayerName(VotekickPlayerID, TargetName, sizeof( TargetName));
if(sscanf(params, "us[128]", VotekickPlayerID, VotekickReason))
{
SendClientMessage(playerid, -1, "[Error:] /votekick <id> <reason>");
}
//
new MyName[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, MyName, sizeof( MyName));
if(IsVotekickStarted == true)
{
SendClientMessage(playerid, -1, "[Error:] Votekick already started!");
}
else
{
if(!IsPlayerConnected(VotekickPlayerID))
{
SendClientMessage(playerid, -1, "[ERROR:] The player is not connected to the server!");
}
else
{
format(string, sizeof(string), "[VOTEKICK] %s has started a votekick on %s reason: %s", MyName, TargetName, VotekickReason);
SendClientMessageToAll(-1, string);
SendClientMessageToAll(-1, "Use /vote to choose YES or NO");
SetTimer("VotekickTimer", 60000, false);
IsVotekickStarted = true;
}
}
return 1;
}
But, ingame it shows like this when I type /votekick without the id and the reason :
(My IGN : LaaT)

Quote:

[Error:] /votekick <id> <reason>
[VOTEKICK] LaaT has started a votekick on LaaT reason :
Use /vote to choose YES or NO
It suppose to show only the [Error:] /votekick <id> <reason> when I type /votekick only.
How can I fix this? My server already had streamer plugin, and I already include the sscanf in my gamemode.

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>