SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 11/09/2011, 07:33 AM   #1
JiMadness
Little Clucker
 
JiMadness's Avatar
 
Join Date: Sep 2011
Location: My house?
Posts: 17
Reputation: 0
Default Converting strcmp command to ZCMD

How to convert this strcmp command to a ZCMD command ??
Code:
	if(strcmp(cmd, "/animhelp", true) == 0 || strcmp(cmd, "/animlist", true) == 0)
	{
		SendClientMessage(playerid, COLOR_GREEN,"____________________________________________");
		SendClientMessage(playerid, COLOR_GRAD1," /handsup, /drunk, /cry, /bomb, /wank, /skate, /lookout,   /hitch,  /crabs, /rap.");
		SendClientMessage(playerid, COLOR_GRAD1," /showoff, /dance, /dj,  /what, /lean, /vomit, /getjiggy,  /robman, /greet, /fucku.");
		SendClientMessage(playerid, COLOR_GRAD2," /fuckme,  /cheer, /cpr, /kiss, /gift, /stand, /fallover,  /taichi, /pedmove.");
		SendClientMessage(playerid, COLOR_GRAD2," /slapass, /laugh, /bj,  /piss, /stop, /crack, /nobreath,  /signal, /followme.");
		SendClientMessage(playerid, COLOR_GRAD3," /gesture 	/hide,  /rob, /wave, /hurt, /smoke, /washhands, /salute, /crossarms.");
		SendClientMessage(playerid, COLOR_GRAD3," /sitdown, /relax, /sit, /dive, /deal, /sleep, /bitchslap, /reload, /checktime.");
        return 1;
	}
    if(strcmp(cmd,"/sit", true) == 0)
	{
	    if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0 || PlayerFrozen[playerid] != 0 || IsPlayerInAnyVehicle(playerid))
		{
  			SendClientMessage(playerid, COLOR_GREY, "   You can't do that at this time !");
			return 1;
		}
	    tmp = strtok(cmdtext, idx);
	    if(!strlen(tmp))
		{
			SendClientMessage(playerid,0xFF0000FF,"USAGE: /sit [1-5]");
			return 1;
		}
		anumber = strval(tmp);
		if(anumber < 1 || anumber > 5) { SendClientMessage(playerid,0xFF0000FF,"USAGE: /sit [1-5]"); return 1; }
		if(anumber == 1) { LoopingAnim(playerid,"BEACH","bather",4.0,1,0,0,0,0); }
		if(anumber == 2) { LoopingAnim(playerid,"BEACH","Lay_Bac_Loop",4.0,1,0,0,0,0); }
		if(anumber == 3) { LoopingAnim(playerid,"BEACH","ParkSit_W_loop",4.0,1,0,0,0,0); }
		if(anumber == 4) { LoopingAnim(playerid,"BEACH","SitnWait_loop_W",4.0,1,0,0,0,0); }
		if(anumber == 4) { LoopingAnim(playerid,"BEACH","SitnWait_loop_W",4.0,1,0,0,0,0); }
		if(anumber == 5) { LoopingAnim(playerid,"BEACH", "ParkSit_M_loop", 4.0,1,0,0,0,0); }
		return 1;
	}
	if(strcmp(cmd,"/nobreath", true) == 0)
	{
	    tmp = strtok(cmdtext, idx);
	    if(!strlen(tmp))
		{
			SendClientMessage(playerid,0xFF0000FF,"USAGE: /nobreath [1-2]");
			return 1;
		}
		anumber = strval(tmp);
		if(anumber < 1 || anumber > 2) { SendClientMessage(playerid,0xFF0000FF,"USAGE: /nobreath [1-2]"); return 1; }
		if(anumber == 1) { LoopingAnim(playerid,"PED","IDLE_tired",4.0,1,0,0,0,0); }
		if(anumber == 2) { LoopingAnim(playerid,"FAT","IDLE_tired",4.0,1,0,0,0,0); }
		return 1;
	}
    if(strcmp(cmd, "/sitonchair", true) == 0 || strcmp(cmd, "/sitdown", true) == 0)
	{
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid,0xFF0000FF,"USAGE: /sitonchair [1-7] or /sitdown [1-7]");
			return 1;
		}
		anumber = strval(tmp);
		if(anumber < 1 || anumber > 7) { SendClientMessage(playerid,0xFF0000FF,"USAGE: /sitonchair [1-7]"); return 1; }
		if(anumber == 1) { LoopingAnim(playerid,"Attractors","Stepsit_in",4.0,0,0,0,1,0); } // Not looping
		else if(anumber == 2) { LoopingAnim(playerid,"CRIB","PED_Console_Loop",4.0,1,0,0,0,0); }
		else if(anumber == 3) { LoopingAnim(playerid,"INT_HOUSE","LOU_In",4.0,0,0,0,1,0); } // Not looping
		else if(anumber == 4) { LoopingAnim(playerid,"MISC","SEAT_LR",4.0,1,0,0,0,0); }
		else if(anumber == 5) { LoopingAnim(playerid,"MISC","Seat_talk_01",4.0,1,0,0,0,0); }
		else if(anumber == 6) { LoopingAnim(playerid,"MISC","Seat_talk_02",4.0,1,0,0,0,0); }
		else if(anumber == 7) { LoopingAnim(playerid,"ped","SEAT_down",4.0,0,0,0,1,0); } // Not looping
		return 1;
	}
	if(strcmp(cmd, "/handsup", true) == 0)
	{
	    if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0 || PlayerFrozen[playerid] != 0 || IsPlayerInAnyVehicle(playerid))
		{
  			SendClientMessage(playerid, COLOR_GREY, "   You can't do that at this time !");
			return 1;
		}
	    SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
        return 1;
    }
    if(strcmp(cmd, "/dance", true) == 0)
	{
	    new Float:x, Float:y, Float:z, Float:v;
		GetPlayerVelocity(playerid, x, y, z);
		v = floatsqroot( floatpower(x,2) + floatpower(y,2) + floatpower(z,2) );

		if(v > 0.05)
		{
  			SendClientMessage(playerid, COLOR_GREY, "   You can't do that at this time !");
  			return 1;
  		}

      	tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid,0xFF0000FF,"USAGE: /dance [style 1-4]");
			return 1;
		}
		if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0 || PlayerFrozen[playerid] != 0 || IsPlayerInAnyVehicle(playerid))
		{
  			SendClientMessage(playerid, COLOR_GREY, "   You can't do that at this time !");
			return 1;
		}
		new dancestyle = strval(tmp);
		if(dancestyle < 1 || dancestyle > 4)
		{
		    SendClientMessage(playerid,0xFF0000FF,"USAGE: /dance [style 1-4]");
			return 1;
		}
		if(dancestyle == 1) SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DANCE1);
		else if(dancestyle == 2) SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DANCE2);
		else if(dancestyle == 3) SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DANCE3);
		else if(dancestyle == 4) SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DANCE4);
 	  	return 1;
	}
    if(strcmp(cmd, "/crossarms", true) == 0)
	{
      	tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid,0xFF0000FF,"USAGE: /crossarms [1-5]");
			return 1;
		}
		if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0 || PlayerFrozen[playerid] != 0 || IsPlayerInAnyVehicle(playerid))
		{
  			SendClientMessage(playerid, COLOR_GREY, "   You can't do that at this time !");
			return 1;
		}
		anumber = strval(tmp);
		if(anumber < 1 || anumber > 6)
		{
            SendClientMessage(playerid,0xFF0000FF,"USAGE: /crossarms [1-5]");
            return 1;
		}
JiMadness is offline   Reply With Quote
Old 11/09/2011, 07:44 AM   #2
Max_Coldheart
Guest
 
Posts: n/a
Default Re: Converting strcmp command to ZCMD

Just change every if(strcmp(cmd, "/cmdnameishere", true) == 0)
to
pawn Code:
CMD:cmdnamehere(playerid, params)
{
     //Your code here
     return 1;
}

Have a nice day !
  Reply With Quote
Old 11/09/2011, 07:50 AM   #3
=WoR=Varth
High-roller
 
=WoR=Varth's Avatar
 
Join Date: Apr 2011
Location: Indonesia
Posts: 2,000
Reputation: 133
Default Re: Converting strcmp command to ZCMD

http://forum.sa-mp.com/showthread.php?t=271043
__________________
(RETIRED)
=WoR=Varth is offline   Reply With Quote
Old 11/09/2011, 07:58 AM   #4
rangerxxll
Gangsta
 
rangerxxll's Avatar
 
Join Date: Aug 2011
Posts: 882
Reputation: 59
Default Re: Converting strcmp command to ZCMD

pawn Code:
COMMAND:animhelp(playerid, cmdtext)
{
        SendClientMessage(playerid, COLOR_GREEN,"____________________________________________");
        SendClientMessage(playerid, COLOR_GRAD1," /handsup, /drunk, /cry, /bomb, /wank, /skate, /lookout,   /hitch,  /crabs, /rap.");
        SendClientMessage(playerid, COLOR_GRAD1," /showoff, /dance, /dj,  /what, /lean, /vomit, /getjiggy,  /robman, /greet, /fucku.");
        SendClientMessage(playerid, COLOR_GRAD2," /fuckme,  /cheer, /cpr, /kiss, /gift, /stand, /fallover,  /taichi, /pedmove.");
        SendClientMessage(playerid, COLOR_GRAD2," /slapass, /laugh, /bj,  /piss, /stop, /crack, /nobreath,  /signal, /followme.");
        SendClientMessage(playerid, COLOR_GRAD3," /gesture  /hide,  /rob, /wave, /hurt, /smoke, /washhands, /salute, /crossarms.");
        SendClientMessage(playerid, COLOR_GRAD3," /sitdown, /relax, /sit, /dive, /deal, /sleep, /bitchslap, /reload, /checktime.");
        return 1;
}

COMMAND:sit(playerid, cmdtext)
{
    if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0 || PlayerFrozen[playerid] != 0 || IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessage(playerid, COLOR_GREY, "   You can't do that at this time !");
            return 1;
        }
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid,0xFF0000FF,"USAGE: /sit [1-5]");
            return 1;
        }
        anumber = strval(tmp);
        if(anumber < 1 || anumber > 5) { SendClientMessage(playerid,0xFF0000FF,"USAGE: /sit [1-5]"); return 1; }
        if(anumber == 1) { LoopingAnim(playerid,"BEACH","bather",4.0,1,0,0,0,0); }
        if(anumber == 2) { LoopingAnim(playerid,"BEACH","Lay_Bac_Loop",4.0,1,0,0,0,0); }
        if(anumber == 3) { LoopingAnim(playerid,"BEACH","ParkSit_W_loop",4.0,1,0,0,0,0); }
        if(anumber == 4) { LoopingAnim(playerid,"BEACH","SitnWait_loop_W",4.0,1,0,0,0,0); }
        if(anumber == 4) { LoopingAnim(playerid,"BEACH","SitnWait_loop_W",4.0,1,0,0,0,0); }
        if(anumber == 5) { LoopingAnim(playerid,"BEACH", "ParkSit_M_loop", 4.0,1,0,0,0,0); }
        return 1;
        }
       
COMMAND:nobreath(playerid, cmdtext)
}
    tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid,0xFF0000FF,"USAGE: /nobreath [1-2]");
            return 1;
        }
        anumber = strval(tmp);
        if(anumber < 1 || anumber > 2) { SendClientMessage(playerid,0xFF0000FF,"USAGE: /nobreath [1-2]"); return 1; }
        if(anumber == 1) { LoopingAnim(playerid,"PED","IDLE_tired",4.0,1,0,0,0,0); }
        if(anumber == 2) { LoopingAnim(playerid,"FAT","IDLE_tired",4.0,1,0,0,0,0); }
        return 1;
}

COMMAND:sitonchair(playerid, cmdtext)
{
    tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid,0xFF0000FF,"USAGE: /sitonchair [1-7] or /sitdown [1-7]");
            return 1;
        }
        anumber = strval(tmp);
        if(anumber < 1 || anumber > 7) { SendClientMessage(playerid,0xFF0000FF,"USAGE: /sitonchair [1-7]"); return 1; }
        if(anumber == 1) { LoopingAnim(playerid,"Attractors","Stepsit_in",4.0,0,0,0,1,0); } // Not looping
        else if(anumber == 2) { LoopingAnim(playerid,"CRIB","PED_Console_Loop",4.0,1,0,0,0,0); }
        else if(anumber == 3) { LoopingAnim(playerid,"INT_HOUSE","LOU_In",4.0,0,0,0,1,0); } // Not looping
        else if(anumber == 4) { LoopingAnim(playerid,"MISC","SEAT_LR",4.0,1,0,0,0,0); }
        else if(anumber == 5) { LoopingAnim(playerid,"MISC","Seat_talk_01",4.0,1,0,0,0,0); }
        else if(anumber == 6) { LoopingAnim(playerid,"MISC","Seat_talk_02",4.0,1,0,0,0,0); }
        else if(anumber == 7) { LoopingAnim(playerid,"ped","SEAT_down",4.0,0,0,0,1,0); } // Not looping
        return 1;
}

COMMAND:handsup(playerid, cmdtext)
{
    if(strcmp(cmd, "/handsup", true) == 0)
    {
        if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0 || PlayerFrozen[playerid] != 0 || IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessage(playerid, COLOR_GREY, "   You can't do that at this time !");
            return 1;
        }
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
        return 1;
}
 
 
COMMAND:dance(playerid, cmdtext)
{
    new Float:x, Float:y, Float:z, Float:v;
        GetPlayerVelocity(playerid, x, y, z);
        v = floatsqroot( floatpower(x,2) + floatpower(y,2) + floatpower(z,2) );

        if(v > 0.05)
        {
            SendClientMessage(playerid, COLOR_GREY, "   You can't do that at this time !");
            return 1;
        }

        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid,0xFF0000FF,"USAGE: /dance [style 1-4]");
            return 1;
        }
        if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0 || PlayerFrozen[playerid] != 0 || IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessage(playerid, COLOR_GREY, "   You can't do that at this time !");
            return 1;
        }
        new dancestyle = strval(tmp);
        if(dancestyle < 1 || dancestyle > 4)
        {
            SendClientMessage(playerid,0xFF0000FF,"USAGE: /dance [style 1-4]");
            return 1;
        }
        if(dancestyle == 1) SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DANCE1);
        else if(dancestyle == 2) SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DANCE2);
        else if(dancestyle == 3) SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DANCE3);
        else if(dancestyle == 4) SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DANCE4);
        return 1;
    }
   
    COMMAND:crossarms(playerid, cmdtext)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid,0xFF0000FF,"USAGE: /crossarms [1-5]");
            return 1;
        }
        if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0 || PlayerFrozen[playerid] != 0 || IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessage(playerid, COLOR_GREY, "   You can't do that at this time !");
            return 1;
        }
        anumber = strval(tmp);
        if(anumber < 1 || anumber > 6)
        {
            SendClientMessage(playerid,0xFF0000FF,"USAGE: /crossarms [1-5]");
            return 1;
        }
rangerxxll is offline   Reply With Quote
Old 11/09/2011, 12:15 PM   #5
BigAl
Huge Clucker
 
Join Date: Oct 2010
Posts: 383
Reputation: 13
Post Re: Converting strcmp command to ZCMD

Yeah that's right, that's a zcmd command
__________________
My work
Drift/Stunt/Dm/Freeroam server
Mafia Vs Police
BigAl is offline   Reply With Quote
Old 11/09/2011, 12:48 PM   #6
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,083
Reputation: 2655
Default Re: Converting strcmp command to ZCMD

Quote:
Originally Posted by rangerxxll View Post
pawn Code:
COMMAND:animhelp(playerid, cmdtext)
This won't compile. ZCMD uses params[], not cmdtext and should be outside any callback.

Quote:
Originally Posted by BigAl View Post
Yeah that's right, that's a zcmd command
And this is spam.
__________________
Vince is offline   Reply With Quote
Old 11/09/2011, 01:20 PM   #7
DRIFT_HUNTER
High-roller
 
Join Date: Oct 2009
Posts: 2,070
Reputation: 188
Default Re: Converting strcmp command to ZCMD

Quote:
Originally Posted by Vince View Post
This won't compile. ZCMD uses params[], not cmdtext and should be outside any callback.
You can change variable names to what ever you want it does not matter just dont mismatch string,integer and float
__________________
Looking for someone to start drifting server, drop me a pm if you are interested.


Any PM's that include question about any kind of help will be ignored.
Use appropriate boards for that
DRIFT_HUNTER is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] Converting strcmp+strtok commands to zcmd+sscanf AndreT Tutorials 2 31/08/2011 10:02 PM
[Tutorial] Converting strcmp(+strtok) to dcmd/zcmd(+sscanf) LarzI Tutorials 13 18/01/2011 06:51 PM


All times are GMT. The time now is 07:09 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.