SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

Thread Tools Display Modes
Old 27/02/2010, 11:19 PM   #1
Huge Clucker
Join Date: Oct 2008
Posts: 419
Reputation: 3

So i have this command:

pawn Code:
cmd(wanted, playerid, params[])
  if(IsPlayerConnected(playerid) && PlayerLoggedIn[playerid])
    if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1)
      new reason[32];
      new player; new wanted;
      if(sscanf(params, "uds",player,wanted,reason))
        SendClientMessage(playerid, COLOR_HELP, "KORISTENJE: /wanted [ID/PartOfName] [wanted] [reason]");
        return 1;
      if(strlen(reason) > 32) strdel(reason, 32, strlen(reason));
  return 1;

And when i type in a reason that's higher than 32 characters it says SERVER: Unkown command, otherwise it's fine.

I put a code underneath that checks is it higher that 32 so it deletes it to be 32 but it didn't help.

Please help, thank you.
Zeromanster is offline  
Old 27/02/2010, 11:25 PM   #2
Nero_3D's Avatar
Join Date: Jun 2007
Location: Germany
Posts: 2,849
Reputation: 675

Its so, the reason array has 32 cells (because of your entered index 32)

and when sscanf try to copy the string into the array and reaches a limit over 32 the code crash (return 0) because reason[32] is an invalid cell

if you use sscanf 1.0 you only can raise the reason string, if you use sscanf 2.0 (the plugin) you can set a size
Nero_3D is offline  
Old 27/02/2010, 11:26 PM   #3
Huge Clucker
Join Date: May 2007
Posts: 202
Reputation: 0

if(sscanf(params, "uds[128]",player,wanted,reason))
Try that.
gotenks918 is offline  

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
zcmd problem QuaTTrO Help Archive 2 16/05/2011 05:45 PM
ZCMD + SSCANF PROBLEM Zeromanster Help Archive 5 22/11/2009 12:03 AM
sscanf and zcmd question about commands with multi parameters Dujma Help Archive 3 21/11/2009 01:24 AM
[Help]Zcmd & sscanf Dirty_bum Help Archive 2 28/10/2009 12:10 PM

All times are GMT. The time now is 05:57 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.