Jump to content
  • 0

Problema Find.


MrAndrei

Question

Problema intalnita (descriere): Problema Find. Am configurat comanda /find, am urmat tutorialul facut de Maurice cu configurare find, am reusit, insa, daca dau /removecp sau /cancel find, checkpointul de la find ramane activ.
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul(obligatoriu):

Comanda /find:

 

if(strcmp(cmd, "/find", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
		    if(PlayerInfo[playerid][pJob] != 1)
		    {
				SendClientMessage(playerid, COLOR_WHITE, "* Nu detii jobul detectiv.");
				return 1;
		    }
			if(UsedFind[playerid] != 0 && PlayerInfo[playerid][pDetSkill] < 0)
			{
			    SendClientMessage(playerid, COLOR_WHITE, "Ai cautat deja pe cineva, asteapta 2 minute pentru a folosi din nou aceasta comanda!");
			    return 1;
			}
			new tmp[145];
		    tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_SYN, "Synthax: /find <playerid/PartOfName>");
				return 1;
			}
			targetid = ReturnUser(tmp);
			if(IsPlayerConnected(targetid))
			{
			    if(targetid != INVALID_PLAYER_ID)
			    {
			        new points;
			        new giveplayerid;
			        new giveplayer[MAX_PLAYER_NAME];
				    GetPlayerName(targetid, pName, sizeof(targetid));
					new Float:X,Float:Y,Float:Z;
					GetPlayerPos(targetid, X,Y,Z);
					SetPlayerCheckpoint(playerid, X,Y,Z, 3.0 );
					FindTime[playerid] = 1;
					FindTimePoints[playerid] = points;
					JucatorCautat[playerid] = giveplayerid;
					PlayerInfo[playerid][pDetSkill] ++;
					format(string, sizeof(string), "Checkpoint will display player %s location. Follow the red checkpoint... ", giveplayer);
					SendClientMessage(playerid, COLOR_YELLOW, string);
					UsedFind[playerid] = 1;
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_WHITE, "   Invalid Name/ID !");
			}
		}
	    return 1;
	}

Am creat un timer de 1 secunda pentru comanda:

forward findtime();
public findtime()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(JucatorCautat[i] >= 0)
		{
		new tinta;
		tinta = JucatorCautat[i];
		new Float: x, Float: y, Float: z;
		GetPlayerPos(tinta,x,y,z);
		SetPlayerCheckpoint(i,x,y,z, 3.0);
		}
	}
}


Imagini / Video (optional): -
Ati incercat sa rezolvati singur?: Da, dar nu am reusit.

Link to comment
Share on other sites

17 answers to this question

Recommended Posts

  • 0

 

	if(strcmp(cmd, "/removecp", true) == 0)
	{
		if(IsPlayerConnected(playerid))
		{
		GetPlayerName(playerid, sendername, sizeof(sendername));
		SendClientMessage(playerid, COLOR_WHITE, "* Checkpointul de pe harta a fost sters cu succes!");
		DisablePlayerCheckpoint(playerid);
		}
		return 1;
	}

 

Edited by MrAndrei
Link to comment
Share on other sites

  • 0
22 hours ago, cOBRa said:

 Ai pus 2 cp-uri pe mapa, unu la comanda si unu la timer + unde ai pus acel timer la comanda?  SetTimerEx, settimer?? Sterge timer-ul.

public findtime()

 

Daca sterg timer-ul sau publicul findtime() , checkpointul nu se va mai plimba dupa jucator.

Link to comment
Share on other sites

  • 0

Poftim adauga comanda asta.

    if(strcmp(cmd, "/removecp", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            KillTimer(FindTimer[playerid]);
            UseFind[playerid] = 0;
            FindPoints[playerid] = 0;
            CP[playerid] = 0;
            DisablePlayerCheckpoint(playerid);
            SendClientMessage(playerid, COLOR_SYN2, "You have canceled Find.");
        }
        return 1;
    }

Link to comment
Share on other sites

  • 0
On 2/7/2016 at 00:37, VeLo said:

Poftim adauga comanda asta.

    if(strcmp(cmd, "/removecp", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            KillTimer(FindTimer[playerid]);
            UseFind[playerid] = 0;
            FindPoints[playerid] = 0;
            CP[playerid] = 0;
            DisablePlayerCheckpoint(playerid);
            SendClientMessage(playerid, COLOR_SYN2, "You have canceled Find.");
        }
        return 1;
    }

 

Am testat, nu merge.

Link to comment
Share on other sites

  • 0

Salut.

Incearca.

 

if(strcmp(cmd, "/removecp", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
        GetPlayerName(playerid, sendername, sizeof(sendername));
        SendClientMessage(playerid, COLOR_WHITE, "* Checkpointul de pe harta a fost sters cu succes!");
        SetTimer("findtime", 1000,false);
        }
        return 1;
    }

 

 

 

Edited by Adrian_Petre

 

 

Link to comment
Share on other sites

  • 0
On 2/8/2016 at 09:14, Adrian_Petre said:

Salut.

Incearca.

 


if(strcmp(cmd, "/removecp", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
        GetPlayerName(playerid, sendername, sizeof(sendername));
        SendClientMessage(playerid, COLOR_WHITE, "* Checkpointul de pe harta a fost sters cu succes!");
        SetTimer("findtime", 1000,false);
        }
        return 1;
    }

 

 

 

 

Nu functioneaza.

Link to comment
Share on other sites

  • 0

Esti sigur ca nu ai 2 comenzi numite la fel?  Daca sunt doua comenzi decat prima va fi luata iar a doua e ca si cum nu exista

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0
On 2/8/2016 at 14:22, Mister said:

Esti sigur ca nu ai 2 comenzi numite la fel?  Daca sunt doua comenzi decat prima va fi luata iar a doua e ca si cum nu exista

 

Sunt sigur. Este doar o comanda  pentru /find.

Link to comment
Share on other sites

  • -1
22 hours ago, cOBRa said:

O intrebare, ramane cp-ul pe mapa sau nu poti folosi alta comanda care necesita un checkpoint?

Ori poate ai definita alta functie in gm, in locul DisablePlayerCheckpoint.

 

Ramane checkpointul pe mapa.

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.