/skin problem
#1

Well I dunno what I didnt add here. Anyone can help me out?

PHP код:
    if (strcmp("/skin"cmdtexttrue10) == 0)
    {
        new 
tmp[256];
        
tmp strtok (cmdtextidx);
        if (!
strlen (tmp))
        {
            
SendClientMessage(playeridCOLOR_RED"USAGE: /skin [ID]");
            return 
1;
          }
        
SetPlayerSkin(playeridstrval(tmp));
        return 
1;
    } 
Didnt get any errors, just it doesnt change my skin when I type /skin 5 or any number. It keeps saying "Unknown Message"
Reply
#2

Because

if (strcmp("/skin", cmdtext, true, 10) == 0)

That handles the command if 'cmdtext' is '/skin', but it's not '/skin' it's '/skin 5'. Use ZCMD/DCMD.
Reply
#3

Quote:
Originally Posted by MP2
Посмотреть сообщение
Because

if (strcmp("/skin", cmdtext, true, 10) == 0)

That handles the command if 'cmdtext' is '/skin', but it's not '/skin' it's '/skin 5'. Use ZCMD/DCMD.
Well the thing Is I am trying to avoid ZCMD :/
Any sort of way to place it in strcmp?
Reply
#4

pawn Код:
if (strcmp("/skin", cmdtext, true, 10) == 0)
Change that to
pawn Код:
if (strcmp("/skin", cmd, true) == 0)
Also, make sure you have 'cmd' defined before any commands.

pawn Код:
new cmd[256];
cmd = strtok(cmdtext, idx);
...Put that before anything in OnPlayerCommandText.

You set /skin to be 10 characters big
pawn Код:
if (strcmp("/skin", cmdtext, true, 10) == 0)
/skin is in fact only 5 and so it only checks if 'cmdtext' was /skin after 10 characters have been used.

You don't even have to put a number. The default is sizeof(cell[]) :I
Reply
#5

Yeah Didn't realize I've put 10 :/ Thanks +rep
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)