SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 23/08/2011, 01:50 PM   #1
Jafet_Macario
Huge Clucker
 
Jafet_Macario's Avatar
 
Join Date: Jul 2011
Posts: 468
Reputation: 63
Default Help

Hey, so I'm trying to make a command with multiple parameters, I mean:
Code:
/put [option] [ammount]
And the option can be " Materials " or " Drugs ".With strcmp I got it, but can't get it with ZCMD, looked over tutorials but didn't find anything like this.So, for exemple:
Code:
 /put Materials 50
and
Code:
 /put Drugs 10
Until now I got this code, but it's not working in game...:
Code:
CMD:put(playerid, params[])
{
    new le = PlayerInfo[playerid][pLeader], me = PlayerInfo[playerid][pMember], string[24], option, value;
	if(le==1||le==2||le==3||le==4||le==7||le==9||le==10||le==11||me==1||me==2||me==3||me==4||me==7||me==9||me==10||me==11) return SCM(playerid, COLOR_GREY,"You are not a gang member");
	else if(!PlayerToPoint(25.0,playerid,2027.5966,1008.9321,10.8203) || !PlayerToPoint(3.0,playerid,-2190.7061,641.7987,49.4375) || !PlayerToPoint(3.0,playerid,2782.7209,-1957.9377,13.5469) || !PlayerToPoint(3.0,playerid,679.4280,-1276.8392,13.5956) || !PlayerToPoint(3.0,playerid,2156.3076,-1455.8517,25.5391) || !PlayerToPoint(3.0,playerid,2494.8640,-1668.1879,13.3438)) return SCM(playerid, COLOR_GREY,"You are not at the right place");
	else if (sscanf(params, "s[24]i", option, value)) return SCM(playerid, COLOR_GREY,"USAGE: /put [Materials/Drugs] [ammount]");
	else
	{
 		if(value > PlayerInfo[playerid][pMats]) return SCM(playerid, COLOR_GRAD2, "You don't have that much!");
 		else
 		{
     		PlayerInfo[playerid][pMats] -= value;
     		PlayerInfo[playerid][pDepositedMats] += value;
     		format(string, sizeof(string), "you deposited %d materials!", value);
     		SendClientMessage(playerid, COLOR_GRAD4, string);
		}
     	if(value > PlayerInfo[playerid][pDrugs]) return SCM(playerid, COLOR_GRAD2, "You don't have that much!");
        else
        {
      		PlayerInfo[playerid][pDrugs] -= value;
      		PlayerInfo[playerid][pDepositedDrugs] += value;
      		format(string, sizeof(string), "you deposited %d grams of drugs!", value);
      		SendClientMessage(playerid, COLOR_GRAD4, string);
		}
	}
	return 1;
}
Anyone can help me out please?
__________________
Jafet_Macario is offline  
Old 24/08/2011, 07:20 AM   #2
=WoR=Varth
High-roller
 
=WoR=Varth's Avatar
 
Join Date: Apr 2011
Location: Indonesia
Posts: 2,046
Reputation: 130
Default Re: Help

Code:
CMD:put(playerid, params[])
{
    new string[10],option,value;
	if(PlayerInfo[playerid][pLeader] == 0 || PlayerInfo[playerid][pMember] == 0) return SCM(playerid, COLOR_GREY,"You are not a gang member");
    if(!PlayerToPoint(25.0,playerid,2027.5966,1008.9321,10.8203) || !PlayerToPoint(3.0,playerid,-2190.7061,641.7987,49.4375) || !PlayerToPoint(3.0,playerid,2782.7209,-1957.9377,13.5469) || !PlayerToPoint(3.0,playerid,679.4280,-1276.8392,13.5956) || !PlayerToPoint(3.0,playerid,2156.3076,-1455.8517,25.5391) || !PlayerToPoint(3.0,playerid,2494.8640,-1668.1879,13.3438)) return SCM(playerid, COLOR_GREY,"You are not at the right place");
    if(sscanf(params,"s[129]d",option,value)) return SCM(playerid, COLOR_GREY,"USAGE: /put [Materials/Drugs] [ammount]");
	if(!strcmp(option,"Materials"))
	{
		if(value > PlayerInfo[playerid][pMats]) SCM(playerid, COLOR_GRAD2, "You don't have that much!");
		else
		{
			PlayerInfo[playerid][pMats] -= value;
			PlayerInfo[playerid][pDepositedMats] += value;
			format(string, sizeof(string), "you deposited %d materials!", value);
			SendClientMessage(playerid, COLOR_GRAD4, string);
		}
		return 1;
	}
	else
	{
		if(value > PlayerInfo[playerid][pDrugs]) SCM(playerid, COLOR_GRAD2, "You don't have that much!");
		else
		{
			PlayerInfo[playerid][pDrugs] -= value;
			PlayerInfo[playerid][pDepositedDrugs] += value;
			format(string, sizeof(string), "you deposited %d grams of drugs!", value);
			SendClientMessage(playerid, COLOR_GRAD4, string);
		}
		return 1;
	}
	SCM(playerid, COLOR_GREY,"USAGE: /put [Materials/Drugs] [ammount]");
	return 1;
}

I recommend you to use IsPlayerInRangeOfPoint.
__________________
(RETIRED)
=WoR=Varth is offline  
Old 24/08/2011, 10:22 AM   #3
Jafet_Macario
Huge Clucker
 
Jafet_Macario's Avatar
 
Join Date: Jul 2011
Posts: 468
Reputation: 63
Default Re: Help

Thanks man!
__________________
Jafet_Macario is offline  
 

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



All times are GMT. The time now is 04:25 PM.


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