Jump to content
  • 0

Nu se actualizează /spec


newbie.

Question

Problema intalnita (descriere): Nu se actualizează spec, de ex. sunt spec pe unu care e în mașină și are viteza de 30km/h, normal viteza crește cu cât merge mai repede, dar rămâne blocată. La fel, când nu e în mașină și intră în una, tre să mă dau off de pe spec și să dau iară pe el.
Liniile de cod / sursa / script-ul(obligatoriu)::

CMD:spec(playerid, params[]) {
    if(playerVariables[playerid][pAdminLevel] >= 1 || playerVariables[playerid][pHelper] >= 1) {
        new
            userID;
        if(sscanf(params, "u", userID)) {
            return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/spec [playerid]");
        }
        else if(!IsPlayerConnectedEx(userID)) {
            return SendClientMessage(playerid, COLOR_GREY, "The specified player is not connected, or has not authenticated.");
        }
        else if(playerVariables[playerid][pWarrants] >= 1) {
            return SendClientMessage(playerid, COLOR_GREY, "You are wanted, you can't spectante anyone.");
        }
        else if(playerVariables[playerid][pPrisonTime] >= 1) {
            return SendClientMessage(playerid, COLOR_GREY, "You can't spectate because you are in jail.");
        }
        else
        {
            if(groupVariables[playerVariables[playerid][pGroup]][gInWar] == 0)
            {
                GetPlayerPos(playerid, TeleportDest[playerid][0],TeleportDest[playerid][1],TeleportDest[playerid][2]);
                Interior[playerid] = GetPlayerInterior(playerid);
                VirWorld[playerid] =  GetPlayerVirtualWorld(playerid);
                TogglePlayerSpectating(playerid, 1);
                playerVariables[playerid][pSpectating] = userID;
                if(IsPlayerInAnyVehicle(userID))
                {
                    new string[500];
                    new Float: health;
                    GetPlayerHealth(userID, health);
                    new Float:health2;
                    new veh = GetPlayerVehicleID(userID);
                    GetVehicleHealth(veh, health2);
                    new Speed = GetSpeed(userID);
                    format(string, 500,"%s [~r~%i~w~] - L [~r~%i~w~]", playerVariables[userID][pNormalName], userID,playerVariables[userID][pLevel]);
                    TextDrawSetString(info[playerid], string);
                    format(string, 500,"Health: ~r~%.0f~w~", health);
                    TextDrawSetString(viata[playerid], string);
                    format(string, 500,"W: [~r~%d~w~] - Jail: [~r~%d~w~ minutes]", playerVariables[userID][pWarrants], playerVariables[userID][pPrisonTime] / 60);
                    TextDrawSetString(wantedjail[playerid], string);
                    format(string, 500,"Car ~r~%d~w~ [~r~%.0f~w~ HP]", GetPlayerVehicleID(userID), health2);
                    TextDrawSetString(carinfo[playerid], string);
                    SetTimer("VitezaSPEC", 1000, true);
                    format(string, 500,"Speed: ~g~%d KM/H~w~", Speed);
                    TextDrawSetString(carspeed[playerid], string);

                    TextDrawShowForPlayer(playerid, info[playerid]);
                    TextDrawShowForPlayer(playerid, carspeed[playerid]);
                    TextDrawShowForPlayer(playerid, carinfo[playerid]);
                    TextDrawShowForPlayer(playerid, viata[playerid]);
                    TextDrawShowForPlayer(playerid, wantedjail[playerid]);
                    DamageLog[playerid] = 1;
                    PlayerSpectateVehicle(playerid, GetPlayerVehicleID(userID));
                }
                else
                {
                    new string[500];
                    new Float: health;
                    GetPlayerHealth(userID, health);
                    new Float:health2;
                    new veh = GetPlayerVehicleID(userID);
                    GetVehicleHealth(veh, health2);
                    format(string, 500,"%s [~r~%i~w~] - L ~r~%i~w~", playerVariables[userID][pNormalName], userID,playerVariables[userID][pLevel]);
                    TextDrawSetString(info[playerid], string);
                    format(string, 500,"Health: [~r~%.0f~w~]", health);
                    TextDrawSetString(viata[playerid], string);
                    format(string, 500,"W: [~r~%d~w~] - Jail: [~r~%d~w~] minutes", playerVariables[userID][pWarrants], playerVariables[userID][pPrisonTime] / 60);
                    TextDrawSetString(wantedjail[playerid], string);
                    TextDrawShowForPlayer(playerid, info[playerid]);
                    TextDrawShowForPlayer(playerid, viata[playerid]);
                    TextDrawShowForPlayer(playerid, wantedjail[playerid]);
                    DamageLog[playerid] = 1;
                    PlayerSpectatePlayer(playerid, userID);
                }
                new Float:HAFloats, country[MAX_COUNTRY_NAME];
                GetPlayerHealth(userID,HAFloats);
                GetCountryName(playerVariables[userID][pConnectionIP], country, sizeof(country));
                format(szMessage, sizeof(szMessage), "(%i) %s | Level: %i | Health: %.1f | Status: %d | Country: %s | Ping: %i",userID, GetName(userID),playerVariables[userID][pLevel], HAFloats,playerVariables[userID][pStatus],country, GetPlayerPing(userID));
                SCM(playerid,COLOR_IN2, szMessage);
            }
            else SendClientMessage(playerid, COLOR_GREY, "You can't use this command in war time.");
        }
    }
    else return SendClientMessage(playerid, COLOR_WHITE, AdminOnly);
    return 1;
}

Ero(area / rile) / warning-(ul / urile): -
Ati incercat sa rezolvati singur?: să fac toată asta într-un timer dar nu știu cum să-l pun la comanda /spec
Imagini / Video (optional): -

Link to comment
Share on other sites

13 answers to this question

Recommended Posts

  • 0

Salut, creaza un public in care sa pui playerul spectator si pui un timer la ingamemodeinit cu public din 2 in 2 secunde.

In public pui ce se intampla in comanda spec astfel incat sa dea spec pe playerul

"playerVariables[playerid][pSpectating]"

 

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

  • 0

Salut, creaza un public in care sa pui playerul spectator si pui un timer la ingamemodeinit cu public din 2 in 2 secunde.

In public pui ce se intampla in comanda spec astfel incat sa dea spec pe playerul

"playerVariables[playerid][pSpectating]"

am făcut chestia asta dar nu mi se compilează deloc...

Link to comment
Share on other sites

  • 0

Posteaza publicul. Probabil ai uitat ceva 

 

forward spectimer(playerid);
public spectimer(playerid)
{
	{
		{
			{
				Interior[playerid] = GetPlayerInterior(playerid);
				VirWorld[playerid] =  GetPlayerVirtualWorld(playerid);
				TogglePlayerSpectating(playerid, 1);
				playerVariables[playerid][pSpectating] = userID;

			    if(IsPlayerInAnyVehicle(userID))
				{

					new string[500];
					new Float: health;
					GetPlayerHealth(userID, health);

					new Float:health2;
			    	new veh = GetPlayerVehicleID(userID);
			    	GetVehicleHealth(veh, health2);

			    	new Speed = GetSpeed(userID);

					format(string, 500,"%s [~r~%i~w~] - L [~r~%i~w~]", playerVariables[userID][pNormalName], userID,playerVariables[userID][pLevel]);
					TextDrawSetString(info[playerid], string);

					format(string, 500,"Health: ~r~%.0f~w~", health);
					TextDrawSetString(viata[playerid], string);

					format(string, 500,"W: [~r~%d~w~] - Jail: [~r~%d~w~ minutes]", playerVariables[userID][pWarrants], playerVariables[userID][pPrisonTime] / 60);
					TextDrawSetString(wantedjail[playerid], string);

					format(string, 500,"Car ~r~%d~w~ [~r~%.0f~w~ HP]", GetPlayerVehicleID(userID), health2);
					TextDrawSetString(carinfo[playerid], string);

					format(string, 500,"Speed: ~g~%d KM/H~w~", Speed);
					TextDrawSetString(carspeed[playerid], string);


					TextDrawShowForPlayer(playerid, info[playerid]);
					TextDrawShowForPlayer(playerid, carspeed[playerid]);
					TextDrawShowForPlayer(playerid, carinfo[playerid]);
					TextDrawShowForPlayer(playerid, viata[playerid]);
					TextDrawShowForPlayer(playerid, wantedjail[playerid]);
					DamageLog[playerid] = 1;

			        PlayerSpectateVehicle(playerid, GetPlayerVehicleID(userID));
			    }
			    else
				{
					new string[500];
					new Float: health;
					GetPlayerHealth(userID, health);

					new Float:health2;
			    	new veh = GetPlayerVehicleID(userID);
			    	GetVehicleHealth(veh, health2);

					format(string, 500,"%s [~r~%i~w~] - L ~r~%i~w~", playerVariables[userID][pNormalName], userID,playerVariables[userID][pLevel]);
					TextDrawSetString(info[playerid], string);

					format(string, 500,"Health: [~r~%.0f~w~]", health);
					TextDrawSetString(viata[playerid], string);

					format(string, 500,"W: [~r~%d~w~] - Jail: [~r~%d~w~] minutes", playerVariables[userID][pWarrants], playerVariables[userID][pPrisonTime] / 60);
					TextDrawSetString(wantedjail[playerid], string);

					TextDrawShowForPlayer(playerid, info[playerid]);
					TextDrawShowForPlayer(playerid, viata[playerid]);
					TextDrawShowForPlayer(playerid, wantedjail[playerid]);
					DamageLog[playerid] = 1;

					PlayerSpectatePlayer(playerid, userID);
				}
				new Float:HAFloats, country[MAX_COUNTRY_NAME];
				GetPlayerHealth(userID,HAFloats);
				GetCountryName(playerVariables[userID][pConnectionIP], country, sizeof(country));
				format(szMessage, sizeof(szMessage), "(%i) %s | Level: %i | Health: %.1f | Status: %d | Country: %s | Ping: %i",userID, GetName(userID),playerVariables[userID][pLevel], HAFloats,playerVariables[userID][pStatus],country, GetPlayerPing(userID));
				SCM(playerid,COLOR_IN2, szMessage);
			}
		}
	}
}

 

Link to comment
Share on other sites

  • 0

Si pune la timere asa


    SetTimer("spectimer", 2000, 1);

forward spectimer();
public spectimer()
{
	for(new i =0;i<MAX_PLAYERS;i++)
	{
	    if(playerVariables[i][pSpectating] != /* Cum  ai tu setata variabila cand dai /specoff*/)
		{
				new targetid = playerVariables[i][pSpectating] ;
				TogglePlayerSpectating(playerid, 1);
			    if(IsPlayerInAnyVehicle(targetid))
				{
					new string[500];
					new Float: health;
					GetPlayerHealth(targetid, health);

					new Float:health2;
			    	new veh = GetPlayerVehicleID(targetid);
			    	GetVehicleHealth(veh, health2);
			    	new Speed = GetSpeed(targetid);

					format(string, 500,"%s [~r~%i~w~] - L [~r~%i~w~]", playerVariables[targetid][pNormalName], targetid,playerVariables[targetid][pLevel]);
					TextDrawSetString(info[playerid], string);

					format(string, 500,"Health: ~r~%.0f~w~", health);
					TextDrawSetString(viata[playerid], string);

					format(string, 500,"W: [~r~%d~w~] - Jail: [~r~%d~w~ minutes]", playerVariables[targetid][pWarrants], playerVariables[targetid][pPrisonTime] / 60);
					TextDrawSetString(wantedjail[playerid], string);

					format(string, 500,"Car ~r~%d~w~ [~r~%.0f~w~ HP]", GetPlayerVehicleID(targetid), health2);
					TextDrawSetString(carinfo[playerid], string);

					format(string, 500,"Speed: ~g~%d KM/H~w~", Speed);
					TextDrawSetString(carspeed[playerid], string);


					TextDrawShowForPlayer(playerid, info[playerid]);
					TextDrawShowForPlayer(playerid, carspeed[playerid]);
					TextDrawShowForPlayer(playerid, carinfo[playerid]);
					TextDrawShowForPlayer(playerid, viata[playerid]);
					TextDrawShowForPlayer(playerid, wantedjail[playerid]);
					DamageLog[playerid] = 1;

			        PlayerSpectateVehicle(playerid, GetPlayerVehicleID(targetid));
			    }
			    else
				{
					new string[500];
					new Float: health;
					GetPlayerHealth(targetid, health);

					new Float:health2;
			    	new veh = GetPlayerVehicleID(targetid);
			    	GetVehicleHealth(veh, health2);

					format(string, 500,"%s [~r~%i~w~] - L ~r~%i~w~", playerVariables[targetid][pNormalName], targetid,playerVariables[targetid][pLevel]);
					TextDrawSetString(info[playerid], string);

					format(string, 500,"Health: [~r~%.0f~w~]", health);
					TextDrawSetString(viata[playerid], string);

					format(string, 500,"W: [~r~%d~w~] - Jail: [~r~%d~w~] minutes", playerVariables[targetid][pWarrants], playerVariables[targetid][pPrisonTime] / 60);
					TextDrawSetString(wantedjail[playerid], string);

					TextDrawShowForPlayer(playerid, info[playerid]);
					TextDrawShowForPlayer(playerid, viata[playerid]);
					TextDrawShowForPlayer(playerid, wantedjail[playerid]);
					DamageLog[playerid] = 1;

					PlayerSpectatePlayer(playerid, targetid);
				}
				new Float:HAFloats, country[MAX_COUNTRY_NAME];
				GetPlayerHealth(targetid,HAFloats);
				GetCountryName(playerVariables[targetid][pConnectionIP], country, sizeof(country));
				format(szMessage, sizeof(szMessage), "(%i) %s | Level: %i | Health: %.1f | Status: %d | Country: %s | Ping: %i",targetid, GetName(targetid),playerVariables[targetid][pLevel], HAFloats,playerVariables[targetid][pStatus],country, GetPlayerPing(targetid));
				SCM(playerid,COLOR_IN2, szMessage);
			}
		}
	}
}

  • Upvote 1

 

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

  • 0

Si pune la timere asa


    SetTimer("spectimer", 2000, 1);

 

Conținut ascuns

ok, dacă pun la ongamemodeinit nu îmi mai apare login, etc. iar dacă pun la comanda /spec -> SetTimer("spectimer", 2000, 1); atunci când dau /spec pe cineva îi lasă pe toți în aer și pică serveru, de ce?

Edited by newbie.
Link to comment
Share on other sites

  • 0

Testezi scripturile direct pe server?  :happy:

Incearca mai intai pe localhost dupa ce te asiguri ca e totul bine pui pe host.

Iar acela a fost un model ti-am dat idea eu nu stiu cum ai tu functiile si variabilele in gm. Adapteaza functia mea la serverul tau asta trebuie sa faci

Edited by Mister

 

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

  • 0

Testezi scripturile direct pe server?  :happy:

Incearca mai intai pe localhost dupa ce te asiguri ca e totul bine pui pe host.

Iar acela a fost un model ti-am dat idea eu nu stiu cum ai tu functiile si variabilele in gm. Adapteaza functia mea la serverul tau asta trebuie sa faci

nu testez direct pe server, asta am testat cu un prieten pe localhost, am scos timeru de la ongamemodeinit și l-am pus la comanda /spec, iar când dau asta, îi dă pe toți în aer, ca și cum ar fi ei spectatori.

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.