SA-MP Forums Archive
Help is needed... - 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: Help is needed... (/showthread.php?tid=550168)



Help is needed... - Th3UnKnOwN - 11.12.2014

How can I make a command not work without the proper amount of score/cash.

Example:
Код:
CMD:test(playerid, params[])
{
       SendClientMessage(playerid, 0xFF00FF, "you need 500 score to use this");
       return 1;
}"
What would I use to make it so you need 500 Score, or even 500 Cash. Both codes would help me out!


Re: Help is needed... - Accent - 11.12.2014

Add this
Код:
if(GetPlayerScore(playerid) < 500)
		{
		SendClientMessage(playerid,-1,"You need 400 score before using this.....");
		return 0;
		}



Re: Help is needed... - Th3UnKnOwN - 11.12.2014

Thanks I will try that. would if work better if I add it like this?

Код:
if(GetPlayerScore(playerid) < 500) return SendClientMessage(playerid, -1, "You need 500 score to use this CMD!");



Re: Help is needed... - Accent - 11.12.2014

Your pawno will throw an error at this,i'm not experienced in pawn,but I think it will.
Код:
CMD:test(playerid, params[])
{
       SendClientMessage(playerid, 0xFF00FF, "you need 500 score to use this");
       return 1;
}"
The " should not be there
It should be like this
Код:
CMD:test(playerid, params[])
{
       SendClientMessage(playerid, 0xFF00FF, "you need 500 score to use this");
       return 1;
}



Re: Help is needed... - Th3UnKnOwN - 11.12.2014

Yes, I know, that was a mistake since I wrote that cmd in the post not in my gm. Could you read my last post? I edited it since you didn't reply till after I did


Re: Help is needed... - Accent - 11.12.2014

Quote:
Originally Posted by Th3UnKnOwN
Посмотреть сообщение
Thanks I will try that. would if work better if I add it like this?

Код:
if(GetPlayerScore(playerid) < 500) return SendClientMessage(playerid, -1, "You need 500 score to use this CMD!");
Ofcourse it will!


Re: Help is needed... - Th3UnKnOwN - 11.12.2014

Thanks :P REP+