SA-MP Forums Archive
/skin in ZCMD - 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 in ZCMD (/showthread.php?tid=303024)



/skin in ZCMD - lamarr007 - 11.12.2011

Hi, i have problem with this code :

new tmp[256];
tmp = strtok(cmdtext,idx);
if(strval(tmp) > 299 || strval(tmp) < 0) return SendClientMessage(playerid, -1,"That skin does not exists");
SetPlayerSkin(playerid,strval(tmp));

How can convert this to zcmd ?


Re: /skin in ZCMD - suhrab_mujeeb - 11.12.2011

pawn Код:
// Top of the script under #include <a_samp>
#include <zcmd>

//Anywhere in the script
CMD:skin(playerid, params[])
{
new tmp[256];
tmp = strtok(cmdtext,idx);
if(strval(tmp) > 299 || strval(tmp) < 0) return SendClientMessage(playerid, -1,"That skin does not exists");
SetPlayerSkin(playerid,strval(tmp));
return 1;
}
I didn't check the code but just made it zcmd for ya.


Re: /skin in ZCMD - lamarr007 - 11.12.2011

D:\Program Files (x86)\Rockstar Games\GTA San Andreas\filterscripts\BamAdmin.pwn(381) : error 017: undefined symbol "cmdtext"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


Re: /skin in ZCMD - Kingunit - 11.12.2011

pawn Код:
new cmdtext;
By the way; why are you using strtok and cmdtext; why not just sscanf?


Re: /skin in ZCMD - Kostas' - 11.12.2011

pawn Код:
// At The Top
#include <a_samp>
#include <zcmd>
#include <sscanf2>


//Anywhere in the script
CMD:skin(playerid, params[])
{
    new skin;
    if(sscanf(params, "i", skin)) return SendClientMessage(playerid, -1, "Usage: /skin [Skin ID]");
    if(skin > 299 || skin < 0) return SendClientMessage(playerid, -1,"Invalid Skin ID!");
    SetPlayerSkin(playerid, skin);
    return 1;
}



Re: /skin in ZCMD - suhrab_mujeeb - 11.12.2011

Convert it to sscanf or go with the regular strcmp.

EDIT: Shit! Kostas is too quick.


Re: /skin in ZCMD - iGetty - 11.12.2011

pawn Код:
CMD:skin(playerid, params[])
{
    new id;
    if(sscanf(params, "d", id)) return SendClientMessage(playerid, 0xFFFFFFFF, "/skin [1 - 129]");
    if(id > 299 || id < 0)
    {
        return SendClientMessage(playerid, -1,"Invalid Skin ID!");
    }
    else
    {
        SetPlayerSkin(playerid, id);
    }
    return 1;
}
Same with me, Kostas -.- <3


Re: /skin in ZCMD - lamarr007 - 11.12.2011

Thx to you !!!


Re: /skin in ZCMD - Kostas' - 11.12.2011

Quote:
Originally Posted by lamarr007
Посмотреть сообщение
Thx to you !!!
Your Welcome!
Quote:
Originally Posted by iGetty
Посмотреть сообщение
Same with me, Kostas -.- <3

Quote:
Originally Posted by suhrab_mujeeb
Посмотреть сообщение
EDIT: Shit! Kostas is too quick.
Lol'd! it was only 1-2 lines.


Re: /skin in ZCMD - ViPGuy - 11.12.2011

Hey,

you should use sccanf

Include all the sccanf stuff and then use this code:

pawn Код:
CMD:skin(playerid,params[])
{
    new skin;
    if(sscanf(params,"i",skin)) SendClientMessage(playerid,0xFFFF00AA,"USAGE: /skin [skin id]");
    if(skin > 299 || skin < 0) SendClientMessage(playerid,0xFFFF00AA,"Invalid Skin ID!");
    else return SetPlayerSkin(playerid,skin);
    return 1;
}