/skin in ZCMD
#1

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 ?
Reply
#2

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.
Reply
#3

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.
Reply
#4

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

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;
}
Reply
#6

Convert it to sscanf or go with the regular strcmp.

EDIT: Shit! Kostas is too quick.
Reply
#7

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
Reply
#8

Thx to you !!!
Reply
#9

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.
Reply
#10

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;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)