Need help with command
#1

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.");
Reply
#2

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

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

Try this first.. i think it do should work
Reply
#4

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.
Reply
#5

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

Should this work?


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

Quote:

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

didnt work it allows all to buy seeds now :P
Reply
#8

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!
}
Reply
#9

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.");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)