Jump to content
  • 0

2 Probleme


Fanta

Question

1.Problema intalnita (descriere): Salut baieti am revenit dupa 5 luni cu o problema la care nu ii dau de cap. Am un gm nu dau nume ca sa nu fac reclama , la care daca stau pe masina primesc slap. Cum pot scoate chestia asta ?
Ero(area / rile) / warning-(ul / urile): nu am

2.Problema intalnita (descriere): Am un script de countdown pe care il pun in gm, nu imi da nicio erroare insa nu imi afiseaza numaratoarea...
Ero(area / rile) / warning-(ul / urile): nu am

Sursa: 

COMANDA PE DINI :

if (strcmp("/count", cmdtext, true, 10) == 0)
{
  if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] >= 1)
            {
SetTimer("five", 1000, 0);
SetTimer("four", 2000, 0);
SetTimer("three", 3000, 0);
SetTimer("two", 4000, 0);
SetTimer("one", 5000, 0);
SetTimer("start", 7000, 0);


   GetPlayerName(playerid, pName, 30);
   format(string, 280, ">> %s started Count-Down.<<", pName);
   SendClientMessageToAll(COLOR_LIGHTBLUE, string);

}
return 1;
}
return 0;
}

COMANDA FACUTA DE MINE PENTRU ZCMD

CMD:count(playerid, params[])
{
  if(IsPlayerConnected(playerid))
        {
            if(playerVariables[playerid][pAdminLevel] >= 1)
            {
SetTimer("five", 1000, 0);
SetTimer("four", 2000, 0);
SetTimer("three", 3000, 0);
SetTimer("two", 4000, 0);
SetTimer("one", 5000, 0);
SetTimer("start", 7000, 0);


   format(string, 280, ">> %s started Count-Down.<<", GetName(playerid));
   SendClientMessageToAll(COLOR_LIGHTBLUE, string);

}
return 1;
}
return 0;
}

Sper sa ma ajutati ca de fiecare data.

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Multumesc amandurora Alexx. mai ajutat mult astept si countdown'u tau :) Cel de la Andrian-Petre se compileaza perfect dar nu are niciun efect dau /time si nu se intampla absolut nimic.

Deci ți-l pun mai jos.

new countdown;

forward CountDownCheck3(playerid);
forward CountDownCheck2(playerid);
forward CountDownCheck1(playerid);
forward CountDownCheckGo(playerid);
forward CountDownFinalize();

public CountDownCheck3(playerid)
{
	GameTextForPlayer(playerid, "~g~3", 1000, 3);
	PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
    SetTimerEx("CountDownCheck2", 1000, 0, "i", playerid);
    return 1;
}

public CountDownCheck2(playerid)
{
	GameTextForPlayer(playerid, "~g~2", 1000, 3);
	PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
    SetTimerEx("CountDownCheck1", 1000, 0, "i", playerid);
    return 1;
}

public CountDownCheck1(playerid)
{
	GameTextForPlayer(playerid, "~g~1", 1000, 3);
	PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
 	SetTimerEx("CountDownCheckGo", 1000, 0, "i", playerid);
 	return 1;
}

public CountDownCheckGo(playerid)
{
	GameTextForPlayer(playerid, "~r~GO GO GO", 3000, 3);
	PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
	TogglePlayerControllable(playerid, 1);
	return 1;
}

public CountDownFinalize()
{
	countdown = 0;
	return 1;
}

CMD:count(playerid, params[])
{
	if(PlayerData[playerid][pAdminLevel] >= 1)
	{
	    new sendername[30],range,string[256],count=0;
	    if(sscanf(params, "i", range)) return SCM(playerid,COLOR_WHITE,"{B8DBFF}Synthax: /count <Range>");
	    {
     		GetPlayerName(playerid, sendername, sizeof(sendername));
 			if(countdown == 0)
    		{
    			foreach(Player,i)
    			{
 		    		if(IsPlayerConnected(i))
					{
	    				if(ProxDetectorS(range, playerid, i))
				    	{
				    	    TogglePlayerControllable(i, 0);
							SetTimerEx("CountDownCheck3", 1000, 0, "i", i);
							SetTimer("CountDownFinalize", 5000, 0);
   							countdown = 1;
   							count++;
						}
					}
				}
				format(string,sizeof(string),"{F81414}AdmWarning: {FFFFFF}Admin %s has started the countdown for %d players. (range: %d)",sendername,count,range);
				submitToHelpersAndAdmins(string, COLOR_WHITE);
			}
			else return SendClientMessage(playerid,COLOR_WHITE, "Countdown is already started.");
		}
	}
	else return SendClientMessage(playerid,COLOR_WHITE,AdminOnly);
	return 1;
}

La OnGameModeInit pui countdown = 0;

 Dacă nu știi unde se pune ceva îmi spui. 

Link to comment
Share on other sites

  • 0

L-am introdus in gm insa imi spune ca function "ProxDetectorS" is not implemented si o am la forward ProxDetectorS(Float:radi, playerid, targetid);

Problema este că nu ai public-ul. Ți-l las mai jos, să-l adaugi lângă celelalte.

public ProxDetectorS(Float:radi, playerid, targetid)
{
    if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
	{
		new Float:posx, Float:posy, Float:posz;
		new Float:oldposx, Float:oldposy, Float:oldposz;
		new Float:tempposx, Float:tempposy, Float:tempposz;
		GetPlayerPos(playerid, oldposx, oldposy, oldposz);
		GetPlayerPos(targetid, posx, posy, posz);
		tempposx = (oldposx -posx);
		tempposy = (oldposy -posy);
		tempposz = (oldposz -posz);
		if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
		{
			return 1;
		}
	}
	return 0;
}

 

Link to comment
Share on other sites

  • 0
SetTimer("five", 1000, 0);
SetTimer("four", 2000, 0);
SetTimer("three", 3000, 0);
SetTimer("two", 4000, 0);
SetTimer("one", 5000, 0);
SetTimer("start", 7000, 0);

 

Timerele astea se activeaza numai daca ai facut publicul . Daca tu nu ai un public numit five care sa afiseze un textdraw, cu numarul , sa zicem, nu o sa mearga niciodata . Faci un public cu un textdraw pentru five , unul pentru four , unul pentru three si tot asa ...

Link to comment
Share on other sites

  • -1

Posibil nu ai facut countdown-ul.la public ma refer.

new times = 60;// setezi numarul de secunde.
new CountDownTimer;
forward timer(playerid);
public timer(playerid)
{
	new string[128];
	if(times > 0)
	{
		times--;
		format(string, sizeof(string), "~w~Mai stai ~r~%d ~w~pana cand incepe cursa.", times - 1);
	}
	else
	{
		times = 60;
		format(string, sizeof(string), "~w~Start!");
		KillTimer(CountDownTimer);
	}
	GameTextForPlayer(playerid, string, 1000, 4);
	return 1;
}
if(strcmp(cmd, "/time", true) == 0)
{
	CountDownTimer = SetTimer("timer", 1000, true);
return 1;
}

 

 

 

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.