Jump to content
  • 0

Question

9 answers to this question

Recommended Posts

  • 0
Posted

Salut, Cedrik nu la asta se referea.

Uite cel mai banal exemplu:
 

new HEALME[MAX_PLAYERS];

La OnPlayerConnect pune:

HEALME[playerid] = 0;//de fiecare data cand se conecteaza playerul va primi valoarea 0.

Acum comanda:

CMD:healme(playerid, params[])
{
if( HEALME[ playerid ] != 0 ) return SendClientMessage( playerid, -1, "Ai luat recent heal.Asteapta 30 secunde." );
SetPlayerHealth(playerid, 100);
SetTimer("reloaded", 30000, 0);
HEALME[playerid] = 1;
SendClientMessage(playerid, -1, "Ai luat heal.Poti folosi comanda dupa 30 de secunde.");
return 1;
}

Si Publicul:

forward reloaded(playerid);
public reloaded(playerid)
{
HEALME[playerid] = 0;
SendClientMessage(playerid, -1, "Acum poti folosi comanda /healme.");
return 1;
}

 

Cam atat.

Aici ai un link catre script.

https://pastebin.com/tDXWqgM7

Poze

 

 

 

  • 0
  • Administrator
Posted

Trebuie să verifici dacă minutele sau ora este / sunt în intervalul pe care îl vrei tu, te poți folosi de gettime.

  • 0
Posted
Acum 8 ore, Th3FuK3R Channel a spus:

Cum o comanda care sa mearga la un anumit interval de timp? 

 daca vrei sa fie folosita de exenplu odata la 30 de secunde ce putin faci un timer de 30 de secunde(sau te folosesti de un timer deja creat de 1s,5s care se repeta si cresti o variabila)Cabd foloseate comanda pui variabila use =1, la timerul de 30s o pui pe 0.verifici daca variabila e pe 0 sa execute comanda

  • 0
Posted
  1. CMD:healme(playerid, params[])
  2. {
  3.  if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
  4.  new sendername[25],string[64];
  5.     GetPlayerName(playerid, sendername, sizeof(sendername));
  6.     if(IsPlayerConnected(playerid))
  7.     {
  8.         if(PlayerInfo[playerid][pAdmin] >= 1)
  9.         {
  10.       format(string, sizeof(string), "{C266AA}AdmCmd: %s used /healme.",sendername);
  11.             ABroadCast(COLOR_YELLOW,string,1);
  12.             foreach(Player,i)
  13.    {
  14.     SetPlayerHealthEx(playerid, 100);
  15.    }
  16.   }
  17.   else return SendClientMessage(playerid, COLOR_ERROR, Nu esti autorizat sa folosesti aceasta comanda);
  18.  }
  19.  return 1;
  20. }

retired

  • 0
Posted
46 minutes ago, Джо said:

Salut, Cedrik nu la asta se referea.

Uite cel mai banal exemplu:
 


new HEALME[MAX_PLAYERS];

La OnPlayerConnect pune:

HEALME[playerid] = 0;//de fiecare data cand se conecteaza playerul va primi valoarea 0.

Acum comanda:


CMD:healme(playerid, params[])
{
if( HEALME[ playerid ] != 0 ) return SendClientMessage( playerid, -1, "Ai luat recent heal.Asteapta 30 secunde." );
SetPlayerHealth(playerid, 100);
SetTimer("reloaded", 30000, 0);
HEALME[playerid] = 1;
SendClientMessage(playerid, -1, "Ai luat heal.Poti folosi comanda dupa 30 de secunde.");
return 1;
}

Si Publicul:


forward reloaded(playerid);
public reloaded(playerid)
{
HEALME[playerid] = 0;
SendClientMessage(playerid, -1, "Acum poti folosi comanda /healme.");
return 1;
}

 

Cam atat.

Aici ai un link catre script.

https://pastebin.com/tDXWqgM7

Poze

 

Pentru deelay-uri de-astea la comenzi de ce nu folosesti SetPVarInt si GetPVarInt + gettime? E mai simplu, nu ocupi atata loc si nu trebuie sa definesti cate o variabila pentru fiecare comanda.

  • 0
Posted
Acum 1 oră, Джо a spus:

Salut, Cedrik nu la asta se referea.

Uite cel mai banal exemplu:
 


new HEALME[MAX_PLAYERS];

La OnPlayerConnect pune:

HEALME[playerid] = 0;//de fiecare data cand se conecteaza playerul va primi valoarea 0.

Acum comanda:


CMD:healme(playerid, params[])
{
if( HEALME[ playerid ] != 0 ) return SendClientMessage( playerid, -1, "Ai luat recent heal.Asteapta 30 secunde." );
SetPlayerHealth(playerid, 100);
SetTimer("reloaded", 30000, 0);
HEALME[playerid] = 1;
SendClientMessage(playerid, -1, "Ai luat heal.Poti folosi comanda dupa 30 de secunde.");
return 1;
}

Si Publicul:


forward reloaded(playerid);
public reloaded(playerid)
{
HEALME[playerid] = 0;
SendClientMessage(playerid, -1, "Acum poti folosi comanda /healme.");
return 1;
}

 

Cam atat.

Aici ai un link catre script.

https://pastebin.com/tDXWqgM7

Poze

 

Multumesc dar ce interval de timp este pus? 30 secunde?

  • 0
Posted
40 minutes ago, Th3FuK3R Channel said:

Multumesc dar ce interval de timp este pus? 30 secunde?

30000 = 30 * 1000

1000 ms = 1 secunda.

Deci da e pus la 30 de secunde.

Retras

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.