SA-MP Forums Archive
Need help with command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need help with command (/showthread.php?tid=450610)



Need help with command - showarn - 13.07.2013

Hello as the topic says i need help with this command i can figure out how i can get it to work alright here it is..

and this is what i need help with.. this command is only allowed to be used by a drug dealer but i also want it to work if your in Faction ID ON faction is "3" and name is "REDNECKS" only That faction should be able to use this command is this possible please help me to understand and create it!



Код:
CMD:buyseeds(playerid, params[])
{
	new amount;
	if(PlayerInfo[playerid][pJob] != DRUGDEALER) return SCM(playerid, COLOR_LIGHTRED, "You are not a drug dealer.");
	if(!PlayerToPoint(3.0, playerid, -392.1880,-1439.1407,26.3389)) return SCM(playerid, COLOR_GREY, "You are not at the drug farm.");
	if(sscanf(params,"d",amount)) return SyntaxMSG(playerid, "/buyseeds [amount] (Each seed costs $200)");
	if(amount < 1) return SCM(playerid, COLOR_GREY, "Invalid amount.");
	new price = amount * 200;
	if(GetCash(playerid) < price) return SCMEx(playerid, COLOR_GREY, "[ERROR]: %d seeds price is %d.", amount, price);
	SCMEx(playerid, COLOR_FADE2, "{C0C0C0}You have successfully bought {FFFFFF}%d {C0C0C0}seeds, you may plant these seeds.", amount);
	SCM(playerid, COLOR_LIGHTRED, "[ATTENTION]: Planting these seeds in public places will get you banned.");
	GiveCash(playerid, -price);
	PlayerInfo[playerid][pSeeds] += amount;
	return 1;
}
somthing like this shud work??


Код:
	if(faction != REDNECKS) return SCM(playerid, COLOR_LIGHTRED, "Invalid faction.");



Re: Need help with command - IceCube! - 13.07.2013

if(PlayerInfo[playerid][pJob] == DRUGDEAL || PlayerInfo[playerid][pFaction] == ...)

I'm guessing that script isn't Unique or isn't yours that your selling.


Re: Need help with command - lider1241 - 13.07.2013

Try this first.. i think it do should work


Re: Need help with command - showarn - 13.07.2013

Quote:
Originally Posted by IceCube!
Посмотреть сообщение
if(PlayerInfo[playerid][pJob] == DRUGDEAL || PlayerInfo[playerid][pFaction] == ...)

I'm guessing that script isn't Unique or isn't yours that your selling.
so i should write like this?

Код:
if(PlayerInfo[playerid][pJob] == DRUGDEAL || PlayerInfo[playerid][pFaction] == 3)
or

Код:
if(PlayerInfo[playerid][pJob] == DRUGDEAL || PlayerInfo[playerid][pFaction] == REDNECKS)
its a friend of me selling it aint me.


Re: Need help with command - IceCube! - 13.07.2013

Whichever your Gamemode is designed to use, I'm guessing the Define is 3 thus does the same/


Re: Need help with command - showarn - 13.07.2013

Should this work?


Код:
	if(PlayerInfo[playerid][pJob] == DRUGDEALER || PlayerInfo[playerid][pFaction] == 3)(playerid, COLOR_LIGHTRED, "You are not a drug dealer.");



Re: Need help with command - showarn - 13.07.2013

Quote:

if(PlayerInfo[playerid][pJob] == DRUGDEAL || PlayerInfo[playerid][pFaction] == 3)

didnt work it allows all to buy seeds now :P


AW: Need help with command - Macronix - 14.07.2013

Maybe:
pawn Код:
if(PlayerInfo[playerid][pFaction] == 3 /*Or REDNECKS*/ || PlayerInfo[playerid][pJob] == DRUGDEALER)
{
//your code for working...
}
else
{
//not in faction 3 or job drugdealer!
}



Re: Need help with command - showarn - 14.07.2013

Like this ?


Код:
CMD:buyseeds(playerid, params[])
{
 if(PlayerInfo[playerid][pFaction] == 3 /*Or REDNECKS*/ || PlayerInfo[playerid][pJob] == DRUGDEALER)
{
	if(!PlayerToPoint(3.0, playerid, -392.1880,-1439.1407,26.3389)) return SCM(playerid, COLOR_GREY, "You are not at the drug farm.");
	if(sscanf(params,"d",amount)) return SyntaxMSG(playerid, "/buyseeds [amount] (Each seed costs $200)");
	if(amount < 1) return SCM(playerid, COLOR_GREY, "Invalid amount.");
	new price = amount * 200;
	if(GetCash(playerid) < price) return SCMEx(playerid, COLOR_GREY, "[ERROR]: %d seeds price is %d.", amount, price);
	SCMEx(playerid, COLOR_FADE2, "{C0C0C0}You have successfully bought {FFFFFF}%d {C0C0C0}seeds, you may plant these seeds.", amount);
	SCM(playerid, COLOR_LIGHTRED, "[ATTENTION]: Planting these seeds in public places will get you banned.");
	GiveCash(playerid, -price);
	PlayerInfo[playerid][pSeeds] += amount;
	return 1;
}
else
{
(playerid, COLOR_LIGHTRED, "You are not a drug dealer.");
}