SA-MP Forums Archive
[ Tutorial ] Commands Time - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [ Tutorial ] Commands Time (/showthread.php?tid=138878)



[ Tutorial ] Commands Time - DonMafia - 03.04.2010

Hello ... This is most often used for commands when you do not want to be abused ... eg. the order / money (/ money) and so on ... We have to show the order / money ....

Somewhere below the top let you include the following:

Код:
 new money [MAX_PLAYERS]; / / definition to add value to 1 to order
Forward publicc (playerid) / / This is the definition of the public returns to 0 [/ code]


You have to let this OnGameModeInit

Код:
 SetTimer (publicc, 60000.1) / / timer for 1 minute .. (1.Minъta = 60000) [/ code]


Now we have to OnPlayerCommandText command itself

Код:
 if (strcmp ("/ money" cmdtext, true, 10) == 0)
(
if (cash [playerid] == 0) (/ / This is when the command has not been used during 1 minute can be used
GivePlayerMoney (playerid, 15,000) / / Add $ 15,000
SendClientMessage (playerid, FARBA_ZLTA, "You gave your money") / / Message to add money
cash [playerid] + = 1; / / This adds a value of 1 .. ie. that it is possible that the value of the command can be used up to 1 min.
Else ()
SendClientMessage (playerid, COLOR_WHITE "command can be used until the 1st minute .."); / / This is a report which prints only when a player tries to use the command less than 1 minute ....
)
return 1;
) [/ Code]


Now somewhere in this fashion to give
Код:
 public publicc (playerid) / / This is a very public return to the value 0 in 1st minute ....
(
cash [playerid] = 0, / / The return value 1minъtu 0th .. ie. The command can be used again.
return 1;
) [/ Code]



Re: [ Tutorial ] Commands Time - MahmutBey - 03.04.2010

hey man whats your problem


Re: [ Tutorial ] Commands Time - Winded - 03.04.2010

Um... i didnt get this


Re: [ Tutorial ] Commands Time - Zh3r0 - 03.04.2010

Quote:
Originally Posted by Winded
Um... i didnt get this
Instead of making a tut maybe he made something to mae us confuse...
it too confusing can't understand..


Re: [ Tutorial ] Commands Time - aircombat - 03.04.2010

guys he meant not abusing a command , but he have done it completely wrong , he set the timer under OnGameModeInit which would make nothing related to the command...


Re: [ Tutorial ] Commands Time - DizeL-ZR- - 04.04.2010

wtf! This code is stupid!! Author teach basics scripting!

Код:
cash [playerid] + = 1;
what is this nonsense?
That's the way cash [playerid] = 1;

Lesson stupid.Many Errors.

First, You taught yourself and then teach others!


Re: [ Tutorial ] Commands Time - Bl4ck J0k3r - 04.04.2010

What is "1 Minuta"?


Re: [ Tutorial ] Commands Time - Torran - 04.04.2010

This tutorial will leave everyone who uses it with errors,
And it wont work anyway, You cant use SetTimer,
As you need to use SetTimerEx for this type of stuff,
But as i said, This tutorial will leave everyone who uses it with errors and wont work..
You can find a working one in my signature!