Jump to content
  • 0

Problema timer


sn1

Question

Salut,ma poate ajuta cineva sa pun un timer de 1 ora in aceasta comanda? Daca incearca cineva sa dea de mai multe ori sa ii dea: Poti da doar un /recrutez pe ora

[pawn]if(strcmp(cmd, "/recrutezmedics", true) == 0)

{

    if(IsPlayerConnected(playerid))

    {

        if(PlayerInfo[playerid][pLeader] != 4)

        {

        SCM(playerid, COLOR_GREY, "* Nu esti Leader Medics!");

        return 1;

        }

else

GetPlayerName(playerid, sendername, sizeof(sendername));

new length = strlen(cmdtext);

while ((idx < length) && (cmdtext[idx] <= ' '))

{

idx++;

}

new offset = idx;

new result[64];

while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))

{

result[idx - offset] = cmdtext[idx];

idx++;

}

result[idx - offset] = EOS;

if(!strlen(result))

{

SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /recrutez [text]");

return 1;

}

if(PlayerInfo[playerid][pAdmin] == 0 || PlayerInfo[playerid][pHelper] == 0)

    {

    for(new i=0; i<MAX_ENTRY; i++)

{

    if(!Swear[0]) continue;

Cenzura(result,Swear);

}

}

SendClientMessageToAll(COLOR_WHITE, "|___________ MEDICS NEWS ANNOUNCEMENT ___________|");

format(string, sizeof(string), "Leader %s says new announce:  %s", sendername, result);

SendClientMessageToAll(COLOR_LIGHTRED, string);

}

return 1;

}[/pawn]

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Salut,ma poate ajuta cineva sa pun un timer de 1 ora in aceasta comanda? Daca incearca cineva sa dea de mai multe ori sa ii dea: Poti da doar un /recrutez pe ora

[pawn]if(strcmp(cmd, "/recrutezmedics", true) == 0)

{

    if(IsPlayerConnected(playerid))

    {

        if(PlayerInfo[playerid][pLeader] != 4)

        {

        SCM(playerid, COLOR_GREY, "* Nu esti Leader Medics!");

        return 1;

        }

else

GetPlayerName(playerid, sendername, sizeof(sendername));

new length = strlen(cmdtext);

while ((idx < length) && (cmdtext[idx] <= ' '))

{

idx++;

}

new offset = idx;

new result[64];

while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))

{

result[idx - offset] = cmdtext[idx];

idx++;

}

result[idx - offset] = EOS;

if(!strlen(result))

{

SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /recrutez [text]");

return 1;

}

if(PlayerInfo[playerid][pAdmin] == 0 || PlayerInfo[playerid][pHelper] == 0)

    {

    for(new i=0; i<MAX_ENTRY; i++)

{

    if(!Swear[0]) continue;

Cenzura(result,Swear);

}

}

SendClientMessageToAll(COLOR_WHITE, "|___________ MEDICS NEWS ANNOUNCEMENT ___________|");

format(string, sizeof(string), "Leader %s says new announce:  %s", sendername, result);

SendClientMessageToAll(COLOR_LIGHTRED, string);

}

return 1;

}[/pawn]

Creezi o variabila la inceput de exemplu:

new timp;
Creezi o functie care scade timpul:

forward ScadeTimp();
public ScadeTimp()
{
    if(timp > 0)
        timp--;
}
La OnGameModeInit apelezi functia:
SetTimer("ScadeTimp", 60000, 1);
La comanda dupa ce se apeleaza pui: Sub
if(PlayerInfo[playerid][pLeader] != 4)
	        {
	            SCM(playerid, COLOR_GREY, "* Nu esti Leader Medics!");
	            return 1;
	        }

if(timp > 0) return SendClientMessage(playerid, -1, "Nu a trecut inca o ora");
Iar sub
SendClientMessageToAll(COLOR_WHITE, "|___________ MEDICS NEWS ANNOUNCEMENT ___________|");
			format(string, sizeof(string), "Leader %s says new announce:  %s", sendername, result);
			SendClientMessageToAll(COLOR_LIGHTRED, string);
Pui
 timp = 60; //60 de minute

 

1859311972_BANNER-GIREADAcopy-min.thumb.png.48e5e420ae2185dce5b244965a1d2601.png

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.