how do i convert strcmp to ZCMD
#1

Can someone convert this to ZCMD?

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

    if(!strcmp(cmdtext, "/disguise", true))//dialog which tells u about the spy class disguises
    {
        if(gClass[playerid] == SPY)
        {
             ShowPlayerDialog(playerid, 88, DIALOG_STYLE_MSGBOX, "{6EF83C}Spy - Disguise Kit:", "/England\n/Soviet Union\n/Taliban\n/United States\n/Australian Armada", "Disguise ","Exit");//Replace the team1,2,3 to your game teams name and colors, by /team1 or /team2 or / team3 the player gets disguise to enemy soldier but don't changes its team
             return 1;
        }
        else return SendClientMessage(playerid, 0xFF0000FF, "You must be a spy to use this command.");
    }

    if(!strcmp(cmdtext, "/england", true))//This is for disguise to team 1
    {
        if(gClass[playerid] == SPY)//if player class spy
        {
             ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguise as England:", "Team: England\nColor: Green\nSkin: 124", "Disguise ","");
             SetPlayerSkin(playerid,124);//skin set to S.W.A.T, can change to ur team skin
             SetPlayerColor(playerid,C_GREEN);//Color Red
             return 1;
        }
        else return SendClientMessage(playerid, 0xFF0000FF, "You must be a spy to use this command.");
    }

    if(!strcmp(cmdtext, "/sovietunion", true))//This is for disguise to team 2
    {
        if(gClass[playerid] == SPY)//if player class spy
        {
             ShowPlayerDialog(playerid, 22, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguise as Soviet Union:", "Team: Soviet Union\nColor: Red\nSkin: 206", "Disguise ","");
             SetPlayerSkin(playerid,206);//skin set to Military, can change to ur team skin
             SetPlayerColor(playerid,C_RED);//Color white
             return 1;
        }
        else return SendClientMessage(playerid, 0xFF0000FF, "You must be a spy to use this command.");
    }

    if(!strcmp(cmdtext, "/taliban", true))//This is for disguise to team 1
    {
        if(gClass[playerid] == SPY)//if player class spy
        {
             ShowPlayerDialog(playerid, 33, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguise as Taliban:", "Team: Taliban\nColor: Yellow\nSkin: 128", "Disguise ","");
             SetPlayerSkin(playerid,128);//skin set to Rockstar, can change to ur team skin
             SetPlayerColor(playerid,C_YELLOW);//Color green
             return 1;
        }
        else return SendClientMessage(playerid, 0xFF0000FF, "You must be a spy to use this command.");
    }

    if(!strcmp(cmdtext, "/unitedstates", true))//This is for disguise to team 2
    {
        if(gClass[playerid] == SPY)//if player class spy
        {
             ShowPlayerDialog(playerid, 22, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguise as United States:", "Team: United States\nColor: Blue\nSkin: 103", "Disguise ","");
             SetPlayerSkin(playerid,103);//skin set to Military, can change to ur team skin
             SetPlayerColor(playerid,C_BLUE);//Color white
             return 1;
        }
        else return SendClientMessage(playerid, 0xFF0000FF, "You must be a spy to use this command.");
    }

    if(!strcmp(cmdtext, "/australia", true))//This is for disguise to team 2
    {
        if(gClass[playerid] == SPY)//if player class spy
        {
             ShowPlayerDialog(playerid, 22, DIALOG_STYLE_MSGBOX, "{6EF83C}Disguise as Australian Armada:", "Team: Australian Armada\nColor: Purple\nSkin: 73", "Disguise ","");
             SetPlayerSkin(playerid,73);//skin set to Military, can change to ur team skin
             SetPlayerColor(playerid,C_PURPLE);//Color white
             return 1;
        }
        else return SendClientMessage(playerid, 0xFF0000FF, "You must be a spy to use this command.");
    }
    return 0;
}
Reply
#2

https://sampwiki.blast.hk/wiki/Command_C...trcmp_to_z_cmd

NOTE: Tutorial doesn't yet have info about parameters, but as you don't have them in any of those commands it's irrelevant.
Reply
#3

There is a Tutorial on this which I'll add after but as a quick example.

Firstly in random code and I'll add again one of your after.

pawn Код:
if(if(!strcmp(cmdtext, "/test", true))
{
    return SendClientMessage(playerid, -1, "Hello World!");
}
Would be in ZCMD:
pawn Код:
CMD:test(playerid) //You do see some with Paramaterss but my command doesn't have any.
{
    SendClientMessage(playerid, -1, "Hello World!");
    return 1;
}
Your Code:
pawn Код:
if(!strcmp(cmdtext, "/disguise", true))//dialog which tells u about the spy class disguises
    {
        if(gClass[playerid] == SPY)
        {
             ShowPlayerDialog(playerid, 88, DIALOG_STYLE_MSGBOX, "{6EF83C}Spy - Disguise Kit:", "/England\n/Soviet Union\n/Taliban\n/United States\n/Australian Armada", "Disguise ","Exit");//Replace the team1,2,3 to your game teams name and colors, by /team1 or /team2 or / team3 the player gets disguise to enemy soldier but don't changes its team
             return 1;
        }
ZCMD:
// Your command doesn't use paramters
pawn Код:
CMD:disguise(playerid) //dialog which tells u about the spy class disguises
    {
        if(gClass[playerid] == SPY)
        {
             ShowPlayerDialog(playerid, 88, DIALOG_STYLE_MSGBOX, "{6EF83C}Spy - Disguise Kit:", "/England\n/Soviet Union\n/Taliban\n/United States\n/Australian Armada", "Disguise ","Exit");//Replace the team1,2,3 to your game teams name and colors, by /team1 or /team2 or / team3 the player gets disguise to enemy soldier but don't changes its team
             return 1;
        }
      return 1;
}
Tutorial: https://sampforum.blast.hk/showthread.php?tid=231496

Okay edits are done I included an example of your code as if your like my ZCMD will just come to you.
Reply
#4

Omg yes! Screw stcmp. It just gave me problems because the command was never found. Now it's working 100% thanks all <3
Reply
#5

Well... Did you really convert it considering our posts weren't made that long ago for you to convert and test a whole mode?

I'm just asking because if your stuck or confused and dont want to banter on here, PM me and I will continue to help you?

As always my skype is Hewlett_T
Reply
#6

let's just say im a fast typer? and i react quickly? lol.

I added you on skype, i may need further assistance if you're willing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)