5 time command
#1

Hi guys, i want to create a command that can be used only 5 times per day , ofc 1 time per player so that will be 5 players will get something that i put into that command. any idea?
Reply
#2

No code, no help...

This is scripting help, not script for you.
Reply
#3

Код HTML:
new Step = 0;
CMD:getpp(playerid)
{
    if(gLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
	{
        if(Step == 0)
		{
		    Step = 1;
	        PlayerInfo[playerid][pDiamonds] += 20;
        	Update(playerid, pDiamondsx);
        	SendClientMessage(playerid, COLOR_SYN, "(!) {FFFFFF}Ai primit 20 Diamante.");
	    }
	    else if(Step == 1)
		{
		    Step = 2;
	        PlayerInfo[playerid][pDiamonds] += 20;
        	Update(playerid, pDiamondsx);
        	SendClientMessage(playerid, COLOR_SYN, "(!) {FFFFFF}Ai primit 20 Diamante.");
	    }
	    else if(Step == 2)
		{
		    Step = 3;
	        PlayerInfo[playerid][pDiamonds] += 20;
        	Update(playerid, pDiamondsx);
        	SendClientMessage(playerid, COLOR_SYN, "(!) {FFFFFF}Ai primit 20 Diamante.");
	    }
	    else if(Step == 3)
		{
		    Step = 4;
	        PlayerInfo[playerid][pDiamonds] += 20;
        	Update(playerid, pDiamondsx);
        	SendClientMessage(playerid, COLOR_SYN, "(!) {FFFFFF}Ai primit 20 Diamante.");
	    }
	    else if(Step == 4)
		{
		    Step = 5;
	        PlayerInfo[playerid][pDiamonds] += 20;
        	Update(playerid, pDiamondsx);
        	SendClientMessage(playerid, COLOR_SYN, "(!) {FFFFFF}Ai primit 20 Diamante.");
	    }
	    else if(Step == 5)
		{
        	SendClientMessage(playerid, COLOR_SYN, "(!) {FFFFFF}Nu mai sunt Diamante.");
	    }
	}
	return 1;
}
Done , thx for help
Reply
#4

Create a static array in the command with 5 slots. These will store the accountids (note: not playerids) of the users that have used it. If the array is full the player can't use it anymore. If the accountid is already in the array the player can't use it anymore. Also create a static variable to store day number and do a time check beforehand to clear the array if the current day doesn't match the day stored in the variable.
Reply
#5

Even though you've thrown up code, it's not even close to being able to do what you're wanting.

Every player, can use this 5 times, until the 5 uses is up. There's no checking whether a player has used it before. The overall structure isn't good, as you can probably cut the lines of code down by not doing the client message, and update inside those if statements.

You could also use Step++, rather than setting the Step to a number each time.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)