5 time command - 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: 5 time command (
/showthread.php?tid=627850)
5 time command -
StR_MaRy - 02.02.2017
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?
Re: 5 time command -
Sew_Sumi - 02.02.2017
No code, no help...
This is scripting help, not script for you.
Re: 5 time command -
StR_MaRy - 02.02.2017
Код 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
Re: 5 time command -
Vince - 02.02.2017
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.
Re: 5 time command -
Sew_Sumi - 02.02.2017
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.