Need help !
#1

Hello I need help for problem with a command admin , when I use / specoff i'am teleported to the hospital and I have to wait 40 seconds before the respawn ,I want just when I use /specoff , I respawn in my normal place without going through the hospital .
Thank you in advance
Reply
#2

can you give your cmd of /specoff?
Reply
#3

What saving system do u use?

EDIT:

This is the base of the script I made for specing:
Edit it to your liking..

Код:
CMD:spec(playerid, params[])
{
	new playerspec;
	if(!sscanf(params, "u", playerspec))
	foreach(Player, i)
	{
		if(PlayerInfo[i][AdminLevel] >= 1)
		{
			if(PlayerInfo[playerid][AdminLevel] >= 1)
			{
				if(isaduty[playerid] == aduty_1)
				{
				    if(isspec[playerid] == nospec)
				    {
						new string[254];
						new playernamespec[MAX_PLAYER_NAME], admin[MAX_PLAYER_NAME];
						GetPlayerName(playerid, admin, sizeof(admin));
						GetPlayerName(playerspec, playernamespec, sizeof(playerspec));
		    			SaveLastPos(playerid);
						TogglePlayerSpectating(playerid, 1);
						PlayerSpectatePlayer(playerid, playerspec);
						format(string, sizeof(string), "[ADMIN] %s is now spectating %s", admin, playernamespec);
						SendClientMessage(i, 0xFF00009A, string);
						isspec[playerid] = yesspec;
						return 1;
					}
					else return SendClientMessage(playerid, 0xFF00009A, "You are already spectating! Use /endspec");
				}
				else return SendClientMessage(playerid, 0xFF00009A, "You are not on admin duty!");
			}
			else return SendClientMessage(playerid, 0xFF00009A, "You are not allowed to use this command!");
		}
	}
	return 1;
}

CMD:endspec(playerid, params[])
{
	foreach(Player, i)
	{
		if(PlayerInfo[i][AdminLevel] >= 1)
		{
			if(PlayerInfo[playerid][AdminLevel] >= 1)
			{
			    if(isspec[playerid] == yesspec)
			    {
					new string[254];
					new admin[MAX_PLAYER_NAME];
					GetPlayerName(playerid, admin, sizeof(admin));
					TogglePlayerSpectating(playerid, 0);
					format(string, sizeof(string), "[ADMIN] %s is no longer spectating!", admin);
					SendClientMessage(i, 0xFF00009A, string);
					isspec[playerid] = nospec;
	    			LoadLastPos(playerid);
					return 1;
				}
				else return SendClientMessage(playerid, 0xFF00009A, "You are not spectating!");
			}
			else return SendClientMessage(playerid, 0xFF00009A, "You are not allowed to use this command!");
		}
	}
	return 1;
}
Reply
#4

CODE :
Код:
if(strcmp(cmd, "/spec", true) == 0) {
//	    new tmp[256];
		tmp = adminspec_strtok(cmdtext, idx);

		if(!strlen(tmp)) {
			SendClientMessage(playerid, COLOR_GREY, "SERVER: /spec [playerid]");
			return 1;
		}
		specid = strval(tmp);
        if(PlayerInfo[playerid][pAdmin] < 1)
		{
  			SendClientMessage(playerid, COLOR_GRAD1, "You are not autorized of use this command");
	    	return 1;
		}
		if(!IsPlayerConnected(specid)) {
			SendClientMessage(playerid, COLOR_GREY, "SERVER: /spec <id>");
			return 1;
		}
		if(specid == playerid) {
  			SendClientMessage(playerid, COLOR_RED, "You can't spec yourself !");
			return 1;
		}
		StartSpectate(playerid, specid);

 		return 1;
	}

	//==========================================[Spec Off]===============//


 	if(strcmp(cmd, "/specoff", true) == 0)
 	{
        if(PlayerInfo[playerid][pAdmin] < 1)
		{
  			SendClientMessage(playerid, COLOR_GRAD1, "You are not autorised to use this command !");
	    	return 1;
		}
 	    StopSpectate(playerid);
		return 1;
	}
Reply
#5

Show us the code from
pawn Код:
StopSpectate(playerid);
Reply
#6

Ok
Код:
//Stop spectating

stock StopSpectate(playerid)
{
    FirstSpawn[playerid] = 1;
	TogglePlayerSpectating(playerid, 0);
	gSpectateID[playerid] = INVALID_PLAYER_ID;
	gSpectateType[playerid] = ADMIN_SPEC_TYPE_NONE;
	GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~n~~w~Spectate off",1000,3);
	return 1;
}

//Advancing spectated player to nexxt valid player: FORWARD

stock AdvanceSpectate(playerid)
{
    if(ConnectedPlayers() == 2) { StopSpectate(playerid); return 1; }
	if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && gSpectateID[playerid] != INVALID_PLAYER_ID) {
	    for(new xx=gSpectateID[playerid]+1; xx<=MAX_PLAYERS; xx++) {
	    	if(xx == MAX_PLAYERS) { xx = 0; }
	        if(IsPlayerConnected(xx) && xx != playerid) {
				if(GetPlayerState(xx) == PLAYER_STATE_SPECTATING && gSpectateID[xx] != INVALID_PLAYER_ID ||
					(GetPlayerState(xx) != 1 && GetPlayerState(xx) != 2 && GetPlayerState(xx) != 3))
				{
					continue;
				}
				else {
					StartSpectate(playerid, xx);
					break;
				}
			}
		}
	}
	return 1;
}
Reply
#7

Where else do you use
pawn Код:
FirstSpawn[playerid]
Is this for saving the place or teleport you on Hospital?
Also, about the waiting...it's the freeze part
pawn Код:
TogglePlayerSpectating(playerid, 0);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)