GetTicketCount() help!
#1

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
Reply
#2

What's the variable of your weed?
Reply
#3

new weed[MAX_PLAYERS];
Reply
#4

Xan you show the /useweed command so i can modifie it?
Reply
#5

if(weed[playerid] <1))
{
SendClientMessage(playerid,COLOR_RED,"You don't have any weed to use!");
return 1;
}
Reply
#6

Sorry . I did a dubble post by excident. The page wasn't loading or something.

Apologizes for that.
Reply
#7

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...
Reply
#8

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
Reply
#9

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
Reply
#10

Код:
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)