SA-MP Forums Archive
[Help] Strange Problem with Sscanf - 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: [Help] Strange Problem with Sscanf (/showthread.php?tid=486830)



[Help] Strange Problem with Sscanf - David (Sabljak) - 10.01.2014

Hello, i will give you example of my problem and you try to help me

Lets said, there is 2 players InGame named SanAndreas and SanAndreasMP.

And i write "/ban SanAndreasMP Wrong Nickname" and server banned SanAndreas...

This is my sscanf code for /ban cmd

Код:
if(sscanf(params,"us[64]",targetid,reason)) return SCM(playerid, Crvena,"Use: {FFFFFF}/ban [ID/Nick] [Reason]");
Help needed

PS. Talking about freeroam/dm gamemode, so there is no Nick_Name


Re: [Help] Strange Problem with Sscanf - Luca12 - 10.01.2014

are you update your sscanf?


Re: [Help] Strange Problem with Sscanf - [TMS]Legena - 10.01.2014

Код:
new targetid;
new Playername[MAX_PLAYER_NAME];
GetPlayerName(targetid, Playername, sizeof(Playername));
if(sscanf(params,"us[64]",targetid,reason)) return SCM(playerid, 0xFF0000,"Use: {FFFFFF}/ban [ID/Nick] [Reason]"
);

Maybe will this work?


Re: [Help] Strange Problem with Sscanf - Konstantinos - 10.01.2014

Quote:
Originally Posted by [TMS]Legena
Посмотреть сообщение
Код:
new targetid;
new Playername[MAX_PLAYER_NAME];
GetPlayerName(targetid, Playername, sizeof(Playername));
if(sscanf(params,"us[64]",targetid,reason)) return SCM(playerid, 0xFF0000,"Use: {FFFFFF}/ban [ID/Nick] [Reason]"
);

Maybe will this work?
No, it will not. Your code will always get the name of the player with ID 0. sscanf line is supposed to be first so the ID from the parameters can be assigned on targetid.


Re: [Help] Strange Problem with Sscanf - David (Sabljak) - 10.01.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
No, it will not. Your code will always get the name of the player with ID 0. sscanf line is supposed to be first so the ID from the parameters can be assigned on targetid.
There is no help for that??

Quote:
Originally Posted by Luca12
Посмотреть сообщение
are you update your sscanf?
ofcourse, im not noob