SA-MP Forums Archive
Storing Money in Vehicle - 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: Storing Money in Vehicle (/showthread.php?tid=602458)



Storing Money in Vehicle - ThatFag - 07.03.2016

Hey.I am trying to make a cmd that allows players to store money in vehicle but i dont know whats wrong with it.
i get no errors at pawno but when i go in game i press the command and it doesnt ask me for amount that i want to put .


here is my script

Код:
COMMAND:store(playerid, params[])
{
 new tmp[300], iAmount;
 if(sscanf(params, "s", tmp, iAmount)) return SCP(playerid, "/(money) [Amount]");
 new car = GetPlayerNearestVehicle(playerid);
	if(GetDistanceFromPlayerToVehicle(playerid, car) > 5.0)
		return SendClientError(playerid, "There is no vehicle around you!");
 if(!strcmp(tmp, "money", true , 7 ))
	{
		if(iAmount > HandMoney(playerid)) return SendClientError(playerid, " You dont have that amount of cash in hand ");
		{
		HandMoney(playerid) -= iAmount;
		comps[car][money] += iAmount;
		SendClientMessage(playerid, COLOR_GREEN, " You have succesfuly stored money in the vehicle " );
		return 1;
		}
	 }



Re: Storing Money in Vehicle - Nero_3D - 07.03.2016

You forgot to add the string size and the integer in the format parameter
PHP код:
sscanf(params"s[300]d"tmpiAmount
Also reduce the string size, 300 is way to big, use something small like 32


Re: Storing Money in Vehicle - ThatFag - 09.03.2016

you didnt get me.
the problem is that it wont ask me for amount that i want to put in vehicle
example it should be like /store money "amount" 13000 ex
but when i do it, it only sends me message "you have successfuly stored cash in vehicle etc"
that is


Re: Storing Money in Vehicle - CodeStyle175 - 09.03.2016

You kinda sound stupid, because command just does what its made to do, it not living thing thats asks amount, you have make it by yourself.


Re: Storing Money in Vehicle - saffierr - 09.03.2016

You can use a dialog for instance, to ask if the player whether wants to store 5k or 50k. the cmd isn't going to ask it if it's not even scripted within.


Re: Storing Money in Vehicle - ThatFag - 09.03.2016

@code that what i need help with , i need to know how to make it ask for amount ..

@saff ill try it making with dialog that is a good idea thanks for it gonna try later.


Re: Storing Money in Vehicle - saffierr - 09.03.2016

Quote:
Originally Posted by ThatFag
Посмотреть сообщение
@code that what i need help with , i need to know how to make it ask for amount ..

@saff ill try it making with dialog that is a good idea thanks for it gonna try later.
Nah, no problem man. if you're facing any issues feel free to ask it.