/spec help
#1

Whenever I use /spec cmd it always just goes in spectate mod for 2 sec and after that it just kills my own player and I respawn as a Zombie. Any suggestions why this may be happening?
Код:
CMD:spec(playerid,params[])
{
    if(pInfo[playerid][pLogged] == 1)
    {
        if(pInfo[playerid][pAdminLevel] >= 1)
        {
            new id;
            if(sscanf(params,"u", id))return SendClientMessage(playerid, COLOR_ORANGE, "{C0C0C0}USAGE: /spec [playerid]");
            if(id == playerid)return SendClientMessage(playerid,COLOR_ORANGE,"{FF0000}You cannot spec yourself.");
            if(id == INVALID_PLAYER_ID)return SendClientMessage(playerid, COLOR_ORANGE,"{FF0000}Player not found!");
            GetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);
            Inter[playerid] = GetPlayerInterior(playerid);
            vWorld[playerid] = GetPlayerVirtualWorld(playerid);
            TogglePlayerSpectating(playerid, true);
            if(IsPlayerInAnyVehicle(id))
            {
                if(GetPlayerInterior(id) > 0)
                {
                    SetPlayerInterior(playerid,GetPlayerInterior(id));
                }
                if(GetPlayerVirtualWorld(id) > 0)
                {
                    SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
                }
                PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));
            }
            else
            {
                if(GetPlayerInterior(id) > 0)
                {
                    SetPlayerInterior(playerid,GetPlayerInterior(id));
                }
                if(GetPlayerVirtualWorld(id) > 0)
                {
                    SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
                }
                PlayerSpectatePlayer(playerid,id);
            }
            GetPlayerName(id, Name, sizeof(Name));
            format(String, sizeof(String),"{ffffff}You have started to spectate %s.",Name);
            SendClientMessage(playerid,0x0080C0FF,String);
            IsSpecing[playerid] = 1;
            IsBeingSpeced[id] = 1;
            spectatorid[playerid] = id;
        }
            else SendClientMessage(playerid,-1,""chat" You must be on admin duty before you spectate! /aod");
    }
   else if(pInfo[playerid][pLogged] == 0)
    {
        printf("%s has been kicked for trying to use a command without being logged in!", PlayerName(playerid));
        Kick(playerid);
    }
    return 1;
}
Reply
#2

/bump
Reply
#3

Quote:
Originally Posted by professional killer
Посмотреть сообщение
Whenever I use /spec cmd it always just goes in spectate mod for 2 sec and after that it just kills my own player and I respawn as a Zombie. Any suggestions why this may be happening?
Код:
CMD:spec(playerid,params[])
{
    if(pInfo[playerid][pLogged] == 1)
    {
        if(pInfo[playerid][pAdminLevel] >= 1)
        {
            new id;
            if(sscanf(params,"u", id))return SendClientMessage(playerid, COLOR_ORANGE, "{C0C0C0}USAGE: /spec [playerid]");
            if(id == playerid)return SendClientMessage(playerid,COLOR_ORANGE,"{FF0000}You cannot spec yourself.");
            if(id == INVALID_PLAYER_ID)return SendClientMessage(playerid, COLOR_ORANGE,"{FF0000}Player not found!");
            GetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);
            Inter[playerid] = GetPlayerInterior(playerid);
            vWorld[playerid] = GetPlayerVirtualWorld(playerid);
            TogglePlayerSpectating(playerid, true);
            if(IsPlayerInAnyVehicle(id))
            {
                if(GetPlayerInterior(id) > 0)
                {
                    SetPlayerInterior(playerid,GetPlayerInterior(id));
                }
                if(GetPlayerVirtualWorld(id) > 0)
                {
                    SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
                }
                PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));
            }
            else
            {
                if(GetPlayerInterior(id) > 0)
                {
                    SetPlayerInterior(playerid,GetPlayerInterior(id));
                }
                if(GetPlayerVirtualWorld(id) > 0)
                {
                    SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
                }
                PlayerSpectatePlayer(playerid,id);
            }
            GetPlayerName(id, Name, sizeof(Name));
            format(String, sizeof(String),"{ffffff}You have started to spectate %s.",Name);
            SendClientMessage(playerid,0x0080C0FF,String);
            IsSpecing[playerid] = 1;
            IsBeingSpeced[id] = 1;
            spectatorid[playerid] = id;
        }
            else SendClientMessage(playerid,-1,""chat" You must be on admin duty before you spectate! /aod");
    }
   else if(pInfo[playerid][pLogged] == 0)
    {
        printf("%s has been kicked for trying to use a command without being logged in!", PlayerName(playerid));
        Kick(playerid);
    }
    return 1;
}
This code is fine when i try to compile it try putting the true to false
Quote:

TogglePlayerSpectating(playerid, true);

To:
Quote:

TogglePlayerSpectating(playerid, True);

Reply
#4

Nah now even spec mode is not starting not even for 2 sec. :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)