Change commands to ZCMD
#1

Hello i need to change this command to Zcmd but i dont know how please help and explen

PHP код:
      if(strcmp(cmd"/crb"true) == || strcmp(cmd"/createroadblock"true) == 0)
    {
        if(
IsPlayerConnected(playerid) && IsACop(playerid) || PlayerInfo[playerid][pAdmin55] >= 2)
         {
            if(
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridCOLOR_LIGHTRED"You can`t place a RoadBlock while you are in a vehicle!");
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_WHITE"USAGE: /crb [Roadblock ID]");
                
SendClientMessage(playerid,COLOR_LIGHTRED"Please choose a roadblock that you would like to place");
                
SendClientMessage(playeridCOLOR_GRAD1"| 1: Crime Scene Roadblock | 2: Medium Roadblock |");
                
SendClientMessage(playeridCOLOR_GRAD1"| 3: Biggest Roadblock | 4: Cones | 5: Reoute. |");
                
SendClientMessage(playeridCOLOR_GRAD1"| 6: Line Closed |");
                return 
1;
            }
            new 
rb strval(tmp);
            if (
rb == 1)
            {
                
PlayerPlaySound(playerid10520.00.00.0);
                new 
Float:plocx,Float:plocy,Float:plocz,Float:ploca;
                
GetPlayerPos(playeridplocxplocyplocz);
                
GetPlayerFacingAngle(playerid,ploca);
                
CreateRoadblock(1459,plocx,plocy,plocz,ploca);
                
//format(string,sizeof(string),"[HQ]: Officer %s has placed a Roadblock(1) at his position, over.",sendername);
                //SendRadioMessage(1,COLOR_BLUE,string);
                
GameTextForPlayer(playerid,"~w~Roadblock ~b~Placed!",3000,1);
                return 
1;
            }
            else if (
rb == 2)
            {
                
PlayerPlaySound(playerid10520.00.00.0);
                new 
Float:plocx,Float:plocy,Float:plocz,Float:ploca;
                
GetPlayerPos(playeridplocxplocyplocz);
                
GetPlayerFacingAngle(playerid,ploca);
                
CreateRoadblock(978,plocx,plocy,plocz+0.6,ploca);
                
//format(string,sizeof(string),"[HQ]: Officer %s has placed a Roadblock(2) at his position, over.",sendername);
                //SendRadioMessage(1,COLOR_BLUE,string);
                
GameTextForPlayer(playerid,"~w~Roadblock ~b~Placed!",3000,1);
                return 
1;
            }
            else if (
rb == 3)
            {
                
PlayerPlaySound(playerid10520.00.00.0);
                new 
Float:plocx,Float:plocy,Float:plocz,Float:ploca;
                
GetPlayerPos(playeridplocxplocyplocz);
                
GetPlayerFacingAngle(playerid,ploca);
                
CreateRoadblock(981,plocx,plocy,plocz+0.9,ploca+180);
                
//format(string,sizeof(string),"[HQ]: Officer %s has placed a Roadblock(3) at his position, over.",sendername);
                //SendRadioMessage(1,COLOR_BLUE,string);
                
GameTextForPlayer(playerid,"~w~Roadblock ~g~Placed!",3000,1);
                
JBC_SetPlayerPos(playeridplocxplocy+1.3plocz);
                return 
1;
            }
            else if (
rb == 4)
            {
                
PlayerPlaySound(playerid10520.00.00.0);
                new 
Float:plocx,Float:plocy,Float:plocz,Float:ploca;
                
GetPlayerPos(playeridplocxplocyplocz);
                
GetPlayerFacingAngle(playerid,ploca);
                
CreateRoadblock(1238,plocx,plocy,plocz+0.2,ploca);
                
//format(string,sizeof(string),"[HQ]: Officer %s has placed a Traffic Cone(1) at his position, over.",sendername);
                //SendRadioMessage(1,COLOR_BLUE,string);
                
GameTextForPlayer(playerid,"~w~Cone ~g~Placed!",3000,1);
                return 
1;
            }
            else if (
rb == 5)
            {
                
PlayerPlaySound(playerid10520.00.00.0);
                new 
Float:plocx,Float:plocy,Float:plocz,Float:ploca;
                
GetPlayerPos(playeridplocxplocyplocz);
                
GetPlayerFacingAngle(playerid,ploca);
                
CreateRoadblock(1425,plocx,plocy,plocz+0.6,ploca);
                
//format(string,sizeof(string),"[HQ]: Officer %s has placed a Detour Sign(4) at his position, over.",sendername);
                //SendRadioMessage(1,COLOR_BLUE,string);
                
GameTextForPlayer(playerid,"~w~Sign ~g~Placed!",3000,1);
                return 
1;
            }
            else if (
rb == 7)
            {
                
PlayerPlaySound(playerid10520.00.00.0);
                new 
Float:plocx,Float:plocy,Float:plocz,Float:ploca;
                
GetPlayerPos(playeridplocxplocyplocz);
                
GetPlayerFacingAngle(playerid,ploca);
                
CreateRoadblock(3091,plocx,plocy,plocz+0.5,ploca+180);
                
//format(string,sizeof(string),"[HQ]: Officer %s has placed a Line Closed Sign(6) at his position, over.",sendername);
                //SendRadioMessage(1,COLOR_BLUE,string);
                
GameTextForPlayer(playerid,"~w~Sign ~g~Placed!",3000,1);
                return 
1;
            }
        }
        else return 
1;
        return 
1;
    } 
Reply
#2

You need sscanf2, zcmd include:

PHP код:
CMD:crb(playeridparams[])
{
        if(
IsPlayerConnected(playerid) && IsACop(playerid) || PlayerInfo[playerid][pAdmin55] >= 2)
         {
            if(
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridCOLOR_LIGHTRED"You can`t place a RoadBlock while you are in a vehicle!");
            if(
sscanf(params"d"rb))
            {
                
SendClientMessage(playeridCOLOR_WHITE"USAGE: /crb [Roadblock ID]");
                
SendClientMessage(playerid,COLOR_LIGHTRED"Please choose a roadblock that you would like to place");
                
SendClientMessage(playeridCOLOR_GRAD1"| 1: Crime Scene Roadblock | 2: Medium Roadblock |");
                
SendClientMessage(playeridCOLOR_GRAD1"| 3: Biggest Roadblock | 4: Cones | 5: Reoute. |");
                
SendClientMessage(playeridCOLOR_GRAD1"| 6: Line Closed |");
                return 
1;
            }
            if (
rb == 1)
            {
                
PlayerPlaySound(playerid10520.00.00.0);
                new 
Float:plocx,Float:plocy,Float:plocz,Float:ploca;
                
GetPlayerPos(playeridplocxplocyplocz);
                
GetPlayerFacingAngle(playerid,ploca);
                
CreateRoadblock(1459,plocx,plocy,plocz,ploca);
                
//format(string,sizeof(string),"[HQ]: Officer %s has placed a Roadblock(1) at his position, over.",sendername);
                //SendRadioMessage(1,COLOR_BLUE,string);
                
GameTextForPlayer(playerid,"~w~Roadblock ~b~Placed!",3000,1);
                return 
1;
            }
            else if (
rb == 2)
            {
                
PlayerPlaySound(playerid10520.00.00.0);
                new 
Float:plocx,Float:plocy,Float:plocz,Float:ploca;
                
GetPlayerPos(playeridplocxplocyplocz);
                
GetPlayerFacingAngle(playerid,ploca);
                
CreateRoadblock(978,plocx,plocy,plocz+0.6,ploca);
                
//format(string,sizeof(string),"[HQ]: Officer %s has placed a Roadblock(2) at his position, over.",sendername);
                //SendRadioMessage(1,COLOR_BLUE,string);
                
GameTextForPlayer(playerid,"~w~Roadblock ~b~Placed!",3000,1);
                return 
1;
            }
            else if (
rb == 3)
            {
                
PlayerPlaySound(playerid10520.00.00.0);
                new 
Float:plocx,Float:plocy,Float:plocz,Float:ploca;
                
GetPlayerPos(playeridplocxplocyplocz);
                
GetPlayerFacingAngle(playerid,ploca);
                
CreateRoadblock(981,plocx,plocy,plocz+0.9,ploca+180);
                
//format(string,sizeof(string),"[HQ]: Officer %s has placed a Roadblock(3) at his position, over.",sendername);
                //SendRadioMessage(1,COLOR_BLUE,string);
                
GameTextForPlayer(playerid,"~w~Roadblock ~g~Placed!",3000,1);
                
JBC_SetPlayerPos(playeridplocxplocy+1.3plocz);
                return 
1;
            }
            else if (
rb == 4)
            {
                
PlayerPlaySound(playerid10520.00.00.0);
                new 
Float:plocx,Float:plocy,Float:plocz,Float:ploca;
                
GetPlayerPos(playeridplocxplocyplocz);
                
GetPlayerFacingAngle(playerid,ploca);
                
CreateRoadblock(1238,plocx,plocy,plocz+0.2,ploca);
                
//format(string,sizeof(string),"[HQ]: Officer %s has placed a Traffic Cone(1) at his position, over.",sendername);
                //SendRadioMessage(1,COLOR_BLUE,string);
                
GameTextForPlayer(playerid,"~w~Cone ~g~Placed!",3000,1);
                return 
1;
            }
            else if (
rb == 5)
            {
                
PlayerPlaySound(playerid10520.00.00.0);
                new 
Float:plocx,Float:plocy,Float:plocz,Float:ploca;
                
GetPlayerPos(playeridplocxplocyplocz);
                
GetPlayerFacingAngle(playerid,ploca);
                
CreateRoadblock(1425,plocx,plocy,plocz+0.6,ploca);
                
//format(string,sizeof(string),"[HQ]: Officer %s has placed a Detour Sign(4) at his position, over.",sendername);
                //SendRadioMessage(1,COLOR_BLUE,string);
                
GameTextForPlayer(playerid,"~w~Sign ~g~Placed!",3000,1);
                return 
1;
            }
            else if (
rb == 7)
            {
                
PlayerPlaySound(playerid10520.00.00.0);
                new 
Float:plocx,Float:plocy,Float:plocz,Float:ploca;
                
GetPlayerPos(playeridplocxplocyplocz);
                
GetPlayerFacingAngle(playerid,ploca);
                
CreateRoadblock(3091,plocx,plocy,plocz+0.5,ploca+180);
                
//format(string,sizeof(string),"[HQ]: Officer %s has placed a Line Closed Sign(6) at his position, over.",sendername);
                //SendRadioMessage(1,COLOR_BLUE,string);
                
GameTextForPlayer(playerid,"~w~Sign ~g~Placed!",3000,1);
                return 
1;
            }
        }
        else return 
1;
        return 
1;

Reply
#3

Its doesnt work dude i thinks its problem with the if (rb == 1)
help me dude to fix it
Reply
#4

bump !!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)