sscanf problem
#1

wtf?
sscanf included
PHP код:
D:\Servers develop\Ukrainian Stunt World\gamemodes\usw.pwn(2047) : error 017undefined symbol "params"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
1 Error

code:
PHP код:
if (strcmp("/setskin"cmdtexttrue10) == 0)
    {
        if(
Player[playerid][pAdmin] >= 1)
        {
        new 
skinid;
        if(
sscanf(params,"d"skinid))
        return 
SendClientMessage(playerid0xFF0000AA"Use: /setskin [id]");
        
SetPlayerSkin(playerid,skinid);
        }
        return 
1;
    } 
Reply
#2

Download the latest sscanf for 0.3e on the sa-mp forum and if it's the script code Click me.
Reply
#3

Quote:
Originally Posted by Shakie
Посмотреть сообщение
Download the latest sscanf for 0.3e on the sa-mp forum and if it's the script code replace it with this:
Код:
CMD:setskin(playerid, params[])
{
     new name[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME], id, skinid, string[128];
     if(!IsPlayerAdmin(playerid)) return 0;
     if(sscanf(params, "ui", id, skinid)) return SendClientMessage(playerid, -1, "USAGE: /setskin [playerid] [skinid]");
     GetPlayerName(playerid, name, MAX_PLAYER_NAME);
     GetPlayerName(id, targetname, MAX_PLAYER_NAME);
     if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Player not connected!");
     SetPlayerSkin(id, skinid);
     format(string, 128, "RCON Admin %s(%d) has set your skinid to %i", name, playerid, skinid);
     SendClientMessage(id, -1, string);
     format(string, 128, "You set %s(%d) skin to skinid %i", targetname, id, skinid);
     SendClientMessage(playerid, -1, string);
     return 1;
}
Check the code properly...

Код:
if (strcmp("/setskin", cmdtext, true, 10) == 0) 
    { 
        if(Player[playerid][pAdmin] >= 1) 
        { 
        new skinid; 
        if(sscanf(cmdtext,"d", skinid)) 
        return SendClientMessage(playerid, 0xFF0000AA, "Use: /setskin [id]"); 
        SetPlayerSkin(playerid,skinid); 
        } 
        return 1; 
    }
I've recently read a post that said, strcmp and sscanf dont work well together, but not sure if that statement is true.

But, I'd recommend YCMD or ZCMD for your command proccesor.
Reply
#4

It works, alright, but you need to alter the statement a bit. You see, cmdtext also includes the command itself. You can use either of these to patch it:

pawn Код:
if(sscanf(cmdtext[8], "d", skindid))
pawn Код:
if(sscanf(cmdtext, "{s[128]}d", skinid))
Second option seems to be the more viable one, as it can be copied to other commands more easily.
Reply
#5

thanks,Vince and Riddy!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)