SA-MP Forums Archive
Spec Command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Spec Command (/showthread.php?tid=390236)



Spec Command - Blackazur - 05.11.2012

Hai GUys, my spec command is bugged, when an admin use it he die automatic, know everyone the problem?

Код:
COMMAND:spec(playerid,params[])
{
    if(PlayerAdmin[playerid] < 1) return SendClientMessage(playerid,COLOR_RED,"You can not use this command!");

    new id;
    if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_RED,"Usage: /spec <player>");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_RED,"Player is not connected!");

	if(GetPVarInt(playerid,"TV") == 0)
	{
	    SetPVarInt(playerid,"TV",1);
		TogglePlayerSpectating(playerid,1);
		PlayerSpectatePlayer(playerid,id);
	}
	else if(GetPVarInt(playerid,"TV") == 1)
	{
	    SetPVarInt(playerid,"TV",0);
	    TogglePlayerSpectating(playerid,0);
	}
	return 1;
}



AW: Spec Command - Blackazur - 12.11.2012

Know everyone an Answer?


Re: Spec Command - Faisal_khan - 12.11.2012

Looks like the second part of the if code is being called. Use this code and tell me if the debug prints this print("spec of"); and print("specing"); and when.
pawn Код:
COMMAND:spec(playerid,params[])
{
    if(PlayerAdmin[playerid] < 1) return SendClientMessage(playerid,COLOR_RED,"You can not use this command!");

    new id;
    if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_RED,"Usage: /spec <player>");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_RED,"Player is not connected!");

    if(GetPVarInt(playerid,"TV") == 0)
    {
        SetPVarInt(playerid,"TV",1);
        TogglePlayerSpectating(playerid,1);
        PlayerSpectatePlayer(playerid,id);
        print("specing...");
    }
    else if(GetPVarInt(playerid,"TV") == 1)
    {
        SetPVarInt(playerid,"TV",0);
        TogglePlayerSpectating(playerid,0);
        print("spec of");
    }
    return 1;
}



AW: Spec Command - Blackazur - 12.11.2012

I dont know so right what you mean with debug prints.


Re: Spec Command - Faisal_khan - 13.11.2012

Execute the commands and then open your server log and check if 'specing' and 'spec off' is being printed there.


AW: Spec Command - Blackazur - 13.11.2012

No its not printed, or so, just that:

[15:23:34] [COMMAND] The Command /spec 0 from Blacky was succesfully!
[15:23:34] [death] Blacky died 255


AW: Spec Command - Blackazur - 14.11.2012

And now?