GetTicketCount() help! - 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: GetTicketCount() help! (
/showthread.php?tid=160647)
GetTicketCount() help! -
Danny - 17.07.2010
Hello,
I'm making a weed system. A player can make weed and use it after that (already done). If you use weed, you receive some health (+20) But the player can use weed whenever they want it, so i think people gonna abuse this. I heard you can make a sort of time limit for a command with GetTicketCount, only i dont know how. Who can help me with this function? A player should be able to use weed every 10 minutes.
Greetz,
Danny
Re: GetTicketCount() help! -
bartje01 - 17.07.2010
What's the variable of your weed?
Re: GetTicketCount() help! -
Danny - 17.07.2010
new weed[MAX_PLAYERS];
Re: GetTicketCount() help! -
TouR - 17.07.2010
Xan you show the /useweed command so i can modifie it?
Re: GetTicketCount() help! -
bartje01 - 17.07.2010
if(weed[playerid] <1))
{
SendClientMessage(playerid,COLOR_RED,"You don't have any weed to use!");
return 1;
}
Re: GetTicketCount() help! -
bartje01 - 17.07.2010
Sorry . I did a dubble post by excident. The page wasn't loading or something.
Apologizes for that.
Re: GetTicketCount() help! -
TouR - 17.07.2010
Quote:
if(weed[playerid] <1))
{
SendClientMessage(playerid,COLOR_RED,"You don't have any weed to use!");
return 1;
}
|
I dont think htis is what he needs...
Re: GetTicketCount() help! -
Danny - 17.07.2010
Ofcourse:
Код:
dcmd_useweed(playerid, cmdtext[]) {
#pragma unused cmdtext
if(weed[playerid] < 2) {
SendClientMessage(playerid,COLOR_RED,"You don't have enough weed!"); return 1;
}
new Float:ph;
GetPlayerHealth(playerid,ph);
ph += 20;
SetPlayerHealth(playerid, ph);
SendClientMessage(playerid, COLOR_GREY,"You have used 2 grams of weed.");
weed[playerid] -= 2;
return 1;
}
@Bart: I need a time limiter, so you can't flood the command to gain health in for example a fight.
EDIT2: your a really fast poster
Re: GetTicketCount() help! -
bartje01 - 17.07.2010
Ow. But a timer for this will be very Non RP.
when you want it to be able every 10 minutes. you need a timer. I can help you later. because I've got to work. maybe tour can help you out?
And your last command. That will be okay I think. When he has less weed than 2 he can't use it now
Re: GetTicketCount() help! -
TouR - 17.07.2010
Код:
new CanWeed[MAX_PLAYERS];
dcmd_useweed(playerid, cmdtext[]) {
#pragma unused cmdtext
if(weed[playerid] < 2) {
SendClientMessage(playerid,COLOR_RED,"You don't have enough weed!"); return 1;
}
if(CanWeed[playerid] == 1)
{
SendClientMessage(playerid,COLOR_RED,"You cant use it now"); return 1;
}
new Float:ph;
CanWeed[playerid] = 1;
GetPlayerHealth(playerid,ph);
ph += 20;
SetPlayerHealth(playerid, ph);
SendClientMessage(playerid, COLOR_GREY,"You have used 2 grams of weed.");
weed[playerid] -= 2;
SetTimerEx("WeedTimer", 600000, false, "i", playerid);// 600000 is 10 minutes if you want change it
return 1;
}
forward WeedTimer(playerid); //somewhere in your script
public WeedTimer(playerid)
{
CanWeed[playerid] = 0;
return 1;
}
This should work