/skin problem - 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: /skin problem (
/showthread.php?tid=344330)
/skin problem -
Squirrel - 20.05.2012
Well I dunno what I didnt add here. Anyone can help me out?
PHP код:
if (strcmp("/skin", cmdtext, true, 10) == 0)
{
new tmp[256];
tmp = strtok (cmdtext, idx);
if (!strlen (tmp))
{
SendClientMessage(playerid, COLOR_RED, "USAGE: /skin [ID]");
return 1;
}
SetPlayerSkin(playerid, strval(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"
Re: /skin problem -
MP2 - 20.05.2012
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.
Re: /skin problem -
Squirrel - 20.05.2012
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?
Re: /skin problem -
[FMJ]PowerSurge - 20.05.2012
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
Re: /skin problem -
Squirrel - 20.05.2012
Yeah
![Cheesy](images/smilies/biggrin.png)
Didn't realize I've put 10 :/ Thanks +rep