CONVERT this cmd TO ZCMD.
#1

Hello.
i want to convert this command to zcmd.

pawn Код:
new cmd[128], tmp[128], idx, glasseid, skin, id;
    cmd = strtok(cmdtext, idx);
   
    if(!strcmp("/sglass",cmd,true))
    {
        tmp = strtok(cmdtext, idx);
        skin = GetPlayerSkin(playerid);
        id = strval(tmp);
       
        if(!id || id > 33) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /sglass [1 - 33]");

        if(id > 30) goto PutPoliceGlasses;
        else
        {
            id--;
            glasseid =  CommonRed + id;
            SetPlayerHoldingObject(playerid, glasseid, 2, SkinOffSet[skin][0], SkinOffSet[skin][1], SkinOffSet[skin][2], SkinOffSet[skin][3], SkinOffSet[skin][4], SkinOffSet[skin][5]);
            return 1;
        }

        PutPoliceGlasses:

        glasseid = CopGlassesBlack + (id - 31);
        SetPlayerHoldingObject(playerid, glasseid, 2, SkinOffSet[skin][0], floatadd(SkinOffSet[skin][1], 0.004500), SkinOffSet[skin][2], SkinOffSet[skin][3], SkinOffSet[skin][4], SkinOffSet[skin][5]);
        return 1;
    }
anyone please help me to do it
Reply
#2

pawn Код:
CMD:sglass(playerid, params[])
{
    new skin = GetPlayerSkin(playerid);
    new id, glasseid;
    if(sscanf(params, "d", id)) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /sglass [1 - 33]");
    if(id < 1 || id > 33) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /sglass [1 - 33]");

    if(id > 30) goto PutPoliceGlasses;
    else
    {
        id--;
        glasseid =  CommonRed + id;
        SetPlayerHoldingObject(playerid, glasseid, 2, SkinOffSet[skin][0], SkinOffSet[skin][1], SkinOffSet[skin][2], SkinOffSet[skin][3], SkinOffSet[skin][4], SkinOffSet[skin][5]);
        return 1;
    }

    PutPoliceGlasses:

    glasseid = CopGlassesBlack + (id - 31);
    SetPlayerHoldingObject(playerid, glasseid, 2, SkinOffSet[skin][0], floatadd(SkinOffSet[skin][1], 0.004500), SkinOffSet[skin][2], SkinOffSet[skin][3], SkinOffSet[skin][4], SkinOffSet[skin][5]);
    return 1;
}
Reply
#3

Ty +rep
Reply
#4

Quote:
Originally Posted by Crazyboobs
Посмотреть сообщение
Ty +rep
Keep in mind you NEED sscanf for the above command to work! You can find it here.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)