Jump to content

Question

Posted

Salut, cine ma poate ajuta si pe mn sa fac un sistem de Auto-AFK, fara comenzile /afk /back? Daca un player nu isi misca userul 3 min sa ii apara culoarea specifica, si dupa ca reintra in joc si se misca putin sa ii apara culoarea pe care o avea inainte specifica fiecarei factiuni.

16 answers to this question

Recommended Posts

Posted

Si yo as avea nevoie de lucrul asta .Daca stie careva va rog ajutati-ne

Detroit The Godfather

Adress : gta.xdevil.ro:7777

Se cauta Lideri , helperi, admini ACTIVI !!!

Posted
Va dau 2 comenzi care fac acelasi lucru numai ca nu automat

new gSpectateID[MAX_PLAYERS];
new gSpectateType[MAX_PLAYERS];

//-----------------------------------------------[afk]---------------------------------------------------------
	if(strcmp(cmd, "/afk", true) == 0)
	{
		if (PlayerInfo[playerid][pAdmin] >= 1)
		{
		    if(IsPlayerConnected(playerid))
		    {
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp)) {
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /afk [playerid]");
				return 1;
			    }
			    specplayerid = strval(tmp);
			    if(!IsPlayerConnected(specplayerid)) {
			    SendClientMessage(playerid, COLOR_RED, "SpectatePlayer: That player isn't active.");
				return 1;
			    }
				tmp = strtok(cmdtext, idx);
				if (PlayerInfo[playerid][pAdmin] >= 1)
				{
	 			TogglePlayerSpectating(playerid, 1);
				PlayerSpectatePlayer(playerid, specplayerid);
				SetPlayerInterior(playerid,GetPlayerInterior(specplayerid));
				gSpectateID[playerid] = specplayerid;
				gSpectateType[playerid] = ADMIN_SPEC_TYPE_PLAYER;

	 		    return 1;
				}
				else
				{
					SendClientMessage(playerid, COLOR_GRAD1, "   Nu esti autorizat pentru a folosi aceasta comanda!");
				}
			}
		}
	    return 1;
	}
			// STOP afk
 	    if(strcmp(cmd, "/afkoff", true) == 0) {
		TogglePlayerSpectating(playerid, 0);
		gSpectateID[playerid] = INVALID_PLAYER_ID;
		gSpectateType[playerid] = ADMIN_SPEC_TYPE_NONE;
		return 1;
	}

Sper ca n-am uitat nik sau nam gresti pe undeva

  • Administrator
Posted

Ceva de genul asta

Pe la inceputul scriptului adaugi asta:

new playerActive[MAX_PLAYERS];
new playerTime[MAX_PLAYERS];
new playerIsPaused[MAX_PLAYERS];
new playerAFK[MAX_PLAYERS];
new playerUpdated[MAX_PLAYERS];
La sfarsitul scriptului pune asta:
forward CheckAFK();
public CheckAFK()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(playerActive[i] == 1)
            {
                if(playerAFK[i] == 1)
                {
                    if(playerUpdated[i] == 0)
                    {
                        format(string, sizeof(string), "%s a fost scos din joc deoarece a stat prea mult timp AFK.", playerName[i]);
                        SendClientMessageToAll(COLOR_PINK, string);
                        playerActive[i] = 0;
                        playerTime[i] = 0;
                        playerIsPaused[i] = 1;
                        SetPlayerVirtualWorld(i, 1337);
                        SetPlayerColor(i, COLOR_WHITE);
                        DestroyVehicle(GetPlayerVehicleID(i));
                        TogglePlayerSpectating(i, 1);
                    }
                    else
                    {
                        playerAFK[i] = 0;
                    }
                }
                else
                {
                    if(playerUpdated[i] == 0)
                    {
                          playerAFK[i] = 1;
                    }
              }
                playerUpdated[i] = 0;
            }
        }
    }
}
La OnGameModeInit adaugi asta
SetTimer("CheckAFK", 2000, true);

logo.png

ATENTIE!!! Nu imi trimiteti mesaje private care au legatura cu scriptingul. NU mai scriptez.

Posted

format(string, sizeof(string), "%s a fost scos din joc deoarece a stat prea mult timp AFK.", playerName[i]);

Viorel eu vreau sa fac atunci cand stai 3 2 minute afk in joc sa iti apara culoarea  0x737373FF gry si cand revii in joc sa te misti putin si sa iti revina culoarea cum era inainte specific factiuni sau in ce esti u civil etc.

  • Administrator
Posted

format(string, sizeof(string), "%s a fost scos din joc deoarece a stat prea mult timp AFK.", playerName[i]);

Viorel eu vreau sa fac atunci cand stai 3 2 minute afk in joc sa iti apara culoarea  0x737373FF gry si cand revii in joc sa te misti putin si sa iti revina culoarea cum era inainte specific factiuni sau in ce esti u civil etc.

De la timerul ala iti setezi dupa cat timp vrei sa-l puna AFK.

logo.png

ATENTIE!!! Nu imi trimiteti mesaje private care au legatura cu scriptingul. NU mai scriptez.

Posted

Victor daca poti sa ma ajuti aici.!!!

C:\Documents and Settings\Personal\Desktop\GameSx 0.3c\gamemodes\gxb.pwn(32801) : error 017: undefined symbol "string"
C:\Documents and Settings\Personal\Desktop\GameSx 0.3c\gamemodes\gxb.pwn(32801) : error 017: undefined symbol "string"
C:\Documents and Settings\Personal\Desktop\GameSx 0.3c\gamemodes\gxb.pwn(32801) : warning 215: expression has no effect
C:\Documents and Settings\Personal\Desktop\GameSx 0.3c\gamemodes\gxb.pwn(32801) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Personal\Desktop\GameSx 0.3c\gamemodes\gxb.pwn(32801) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Linia
format(string, sizeof(string), "%s a fost scos din joc deoarece a stat prea mult timp AFK.", playerName[i]);
public CheckAFK()
{
   for(new i = 0; i < MAX_PLAYERS; i++)
   {
       if(IsPlayerConnected(i))
       {
           if(playerActive[i] == 1)
           {
               if(playerAFK[i] == 1)
               {
                   if(playerUpdated[i] == 0)
                   {
                       format(string, sizeof(string), "%s a fost scos din joc deoarece a stat prea mult timp AFK.", playerName [i]);
                       SendClientMessageToAll(COLOR_PINK, string);
                       playerActive[i] = 0;
                       playerTime[i] = 0;
                       playerIsPaused[i] = 1;
                       SetPlayerVirtualWorld(i, 1337);
                       SetPlayerColor(i, COLOR_WHITE);
                       DestroyVehicle(GetPlayerVehicleID(i));
                       TogglePlayerSpectating(i, 1);
				   }
				   else
				   {
                       playerAFK[i] = 0;
					}
	            }
	            else
	            {
                       if(playerUpdated[i] == 0)
                       {
                           playerAFK[i] = 1;
					   }
				   }
                     playerUpdated[i] = 0;
				  }
			   }
		   }
	  }

Victor si am si eu o intrebare cu referire la ce mi-ai dat !!dupa 2 minute cat ai pus u acolo se pune intr-o anumita culoare adica cum ar fi gry si cand revii in joc se face culoarea cum era inainte?

Posted

Pune un timer cu SetTimerEx "AFKCheck" si in timer iei pozitia si o verifici cu cea veche mereu, daca sunt aceleasi, e AFK. Daca nu, nu este sau a revenit.

-Toate tutorialele postate intra aici sau puneti-le direct [url=http://www.sa-mp.ro/forum/index

Posted

C:\Documents and Settings\Personal\Desktop\GameSx 0.3c\gamemodes\gxb.pwn(32801) : error 017: undefined symbol "string"
C:\Documents and Settings\Personal\Desktop\GameSx 0.3c\gamemodes\gxb.pwn(32801) : error 017: undefined symbol "string"
C:\Documents and Settings\Personal\Desktop\GameSx 0.3c\gamemodes\gxb.pwn(32801) : warning 215: expression has no effect
C:\Documents and Settings\Personal\Desktop\GameSx 0.3c\gamemodes\gxb.pwn(32801) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Personal\Desktop\GameSx 0.3c\gamemodes\gxb.pwn(32801) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Linia
format(string, sizeof(string), "%s a fost scos din joc deoarece a stat prea mult timp AFK.", playerName[i]);
public CheckAFK()
{
   for(new i = 0; i < MAX_PLAYERS; i++)
   {
       if(IsPlayerConnected(i))
       {
           if(playerActive[i] == 1)
           {
               if(playerAFK[i] == 1)
               {
                   if(playerUpdated[i] == 0)
                   {
                       format(string, sizeof(string), "%s a fost scos din joc deoarece a stat prea mult timp AFK.", playerName [i]);
                       SendClientMessageToAll(COLOR_PINK, string);
                       playerActive[i] = 0;
                       playerTime[i] = 0;
                       playerIsPaused[i] = 1;
                       SetPlayerVirtualWorld(i, 1337);
                       SetPlayerColor(i, COLOR_WHITE);
                       DestroyVehicle(GetPlayerVehicleID(i));
                       TogglePlayerSpectating(i, 1);
				   }
				   else
				   {
                       playerAFK[i] = 0;
					}
	            }
	            else
	            {
                       if(playerUpdated[i] == 0)
                       {
                           playerAFK[i] = 1;
					   }
				   }
                     playerUpdated[i] = 0;
				  }
			   }
		   }
	  }

ma poate ajuta cineva sa rezolv aceste errori?

  • Administrator
Posted

new string[128];

Adauga pe la inceputul scriptului.

logo.png

ATENTIE!!! Nu imi trimiteti mesaje private care au legatura cu scriptingul. NU mai scriptez.

Posted

Tot nu merge

C:\Documents and Settings\Personal\Desktop\GameSx 0.3c\gamemodes\gxb.pwn(34177) : error 017: undefined symbol "playerName"
C:\Documents and Settings\Personal\Desktop\GameSx 0.3c\gamemodes\gxb.pwn(34177) : warning 215: expression has no effect
C:\Documents and Settings\Personal\Desktop\GameSx 0.3c\gamemodes\gxb.pwn(34177) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Personal\Desktop\GameSx 0.3c\gamemodes\gxb.pwn(34177) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Personal\Desktop\GameSx 0.3c\gamemodes\gxb.pwn(34177) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
public CheckAFK()
{
   new string[128];
   for(new i = 0; i < MAX_PLAYERS; i++)
   {
       if(IsPlayerConnected(i))
       {
           if(playerActive[i] == 1)
           {
               if(playerAFK[i] == 1)
               {
                   if(playerUpdated[i] == 0)
                   {
                       format(string, sizeof(string), "%s a fost scos din joc deoarece a stat prea mult timp AFK.", playerName [i]);
                       SendClientMessageToAll(COLOR_PINK, string);
                       playerActive[i] = 0;
                       playerTime[i] = 0;
                       playerIsPaused[i] = 1;
                       SetPlayerVirtualWorld(i, 1337);
                       SetPlayerColor(i, COLOR_WHITE);
                       DestroyVehicle(GetPlayerVehicleID(i));
                       TogglePlayerSpectating(i, 1);
				   }
				   else
				   {
                       playerAFK[i] = 0;
					}
	            }
	            else
	            {
                       if(playerUpdated[i] == 0)
                       {
                           playerAFK[i] = 1;
					   }
				   }
                     playerUpdated[i] = 0;
				  }
			   }
		   }
	  }

  • Administrator
Posted

Asta o puteai repara singur.

Ori stergeai linile alea unde zice ca "cutarica" a fost scos din joc si ...

Ori adaugai pe la inceput

new playerName[MAX_PLAYERS];
sau
new playerName[MAX_PLAYERS][24];

Vezi care merge.

logo.png

ATENTIE!!! Nu imi trimiteti mesaje private care au legatura cu scriptingul. NU mai scriptez.

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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.