Jump to content

Recommended Posts

Posted (edited)

Salut! Am incercat sa fac ca atunci cand un admin da /spec, sa ii ia pozitia, iar cand da /specoff sa-l dea tot acolo, unde a dat /spec. Am facut new Float:SpecDest[MAX_PLAYERS][3], dupa am facut cand da /spec GetPlayerPos(play erid, SpecDest[pla yerid][0],SpecDest[play erid][1],SpecDest[play erid][2]), iar cand da /specoff SetPlayerPos(play erid, SpecDest[pla yerid][0],SpecDest[play erid][1],SpecDest[play erid][2]). La /specoff era Spawn(play erid) pe care am sters-o si tot ma spawneaza. Nu reusesc sa fac sa nu ma mai spawneze. Am gm Sa***s-N***rk, daca va ajuta cu ceva. P.S am lasat spatiu la player id sa nu apara legatura aceea cu panelul. Ma poate ajuta careva va rog?

Edited by mihaissss
Posted (edited)

Nu inteleg.

Deci, am pus undeva 'new Float:SpecDest[MAX_PLAYERS][3]'. 

M-am dus la comanda /spec si am pus:

GetPlayerPos(playerid, SpecDest[0], SpecDest[1], SpecDest[2]);

 

La comanda /specoff aveam 'SpawnPlayer(playerid);', pe care am sters-o si am pus:

SetPlayerPos(playerid, SpecDest[0], SpecDest[1], SpecDest[2]);

 

Problema este ca tot ma spawneaza. Am cautat si nu reusesc sa fac ca atunci cand dau /spec sa imi ia pozitia, si cand dau /specoff sa imi seteze pozitia in care eram cand am dat /spec. 

Edited by mihaissss
Posted (edited)

Comenzi 

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(AFK[playerid] >= 1) {
		    return SendClientMessage(playerid, COLOR_GREY, "You can't spectate because you are sleeping.");
		}
		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 [%i] - L %i", playerVariables[userID][pNormalName], userID,playerVariables[userID][pLevel]);
					TextDrawSetString(info[playerid], string);

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

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

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

					format(string, 500,"Speed: %d KM/H", 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]);

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

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

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

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

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

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

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

					TextDrawShowForPlayer(playerid, info[playerid]);
					TextDrawShowForPlayer(playerid, viata[playerid]);
					TextDrawShowForPlayer(playerid, wantedjail[playerid]);

					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, AdminhOnly);
	return 1;
}
CMD:specoff(playerid, params[])
{
    if(playerVariables[playerid][pSpectating] != INVALID_PLAYER_ID && playerVariables[playerid][pAdminLevel] >= 1 || playerVariables[playerid][pSpectating] != INVALID_PLAYER_ID && playerVariables[playerid][pHelper] >= 1 )
	{
			TextDrawHideForPlayer(playerid, info[playerid]);
			TextDrawHideForPlayer(playerid, carspeed[playerid]);
			TextDrawHideForPlayer(playerid, carinfo[playerid]);
			TextDrawHideForPlayer(playerid, viata[playerid]);
			TextDrawHideForPlayer(playerid, wantedjail[playerid]);
			TogglePlayerSpectating(playerid, 0);
	}
	return 1;
}

News: 

new
	Float:f_Sx[MAX_PLAYERS],
	Float:f_Sy[MAX_PLAYERS],
	Float:f_Sz[MAX_PLAYERS],
	f_Int[MAX_PLAYERS],
	Float:f_Ang[MAX_PLAYERS],
	f_Vw[MAX_PLAYERS];
new Float:TeleportDest[MAX_PLAYERS][3];	
new Interior[MAX_PLAYERS];
new VirWorld[MAX_PLAYERS];

 

Edited by Essex.
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. 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.

moduri samp