SA-MP Forums Archive
How to make... - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to make... (/showthread.php?tid=136038)



How to make... - Steven82 - 22.03.2010

How do i create a command that can be....like NVM...i give you an EX.


a /plantweed command?

How do i make it so it plants where the player stands and not just one spot?


Re: How to make... - adsy - 22.03.2010

GetPlayerPos(playerid, x, y, z);

use the x y and z to place then.


Re: How to make... - 02manchestera - 22.03.2010

Post your cmd ere will make it easier to sort it for you


Re: How to make... - Steven82 - 22.03.2010

Quote:
Originally Posted by adsy
GetPlayerPos(playerid, x, y, z);

use the x y and z to place then.
But like lets say i want to plant weed way over there and i do /plantweed


then i go somewhere else and do /plantweed....


I want the weed to plant where ever they do

/plantweed


EDIT:

I do not post my commands or coding anymore i have already had 1 RP script stole from me...:@
so i was just asking is that the right coding?


Re: How to make... - adsy - 22.03.2010

im not writing it all for you. get an example script together and we can "edit" it in.


Re: How to make... - Steven82 - 22.03.2010

I know it will be a simple script were you do like /plantweed and aw...wth i will make it right now and post it xD not a big command xD


Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/plantweed", cmdtext, true, 10) == 0)
	{
	//CreateObject want to also add when you plant weed the Bush ID i already have it but need Cordinates
	SendClientMessage(playerid, COLOR_GREEN, " You weed has been planted come back later");
	GivePlayerMoney(playerid, -10);
		return 1;
	}
	if (strcmp("/pickweed", cmdtect, true, 10) == 0)
	{
	// I want to destroy ojbect when picked
	SendClientMessage(playerid, COLOR_GREEN, " You have just picked your weed now type: (/weedhelp) to learn how to sell it.");

	return 0;
}



Re: How to make... - adsy - 22.03.2010

do you want lots of weeds from 1 player or 1 weed per player



Re: How to make... - Steven82 - 22.03.2010

1 weed per player and like they have to wait like 30 minutes until they can /pickweed


Re: How to make... - adsy - 22.03.2010

something like my onespot filterscript then

http://forum.sa-mp.com/index.php?topic=157116.0

change st to plantweed and mt to pickweed

youll want to start a timer under plantweed then

Код:
SetTimer("plantwait", (60000*30), 0);
plant[playerid]=1;
and a new somewhere outside

Код:
new plant[MAX_PLAYERS];
the function should simply change the variable plant back to 0

Код:
forward plantwait(playerid)
public plantwait(playerid){
plant[playerid]=0;
return 1;
}
then under your modified /mt command just add an if

Код:
if(plant[playerid] == 1){
MESSAGE HERE
}
else{
if player is near the plant allow picking
else message to say you arent near your plant
}
think you can work from that?

EDIT: you will probably need an anti replant to prevent multiple timers and multiple plants per player, only the last one planted coords will work though.


Re: How to make... - Steven82 - 23.03.2010

Everytime i try to compile error, error, whatever i will try to make it and fail drasticly until i get it but thanks anyway guys.