/spec help.
#1

The spectating part works, but when you type /spec for another player it keeps flickering back and changing players at random. Also when a person types /specoff your screen flickers and custom made objects reload them selfs causing yourself to fall through.

Also, what kind of functions would i use to make it scroll through players when they press the left mouse button.

Thanks in advance.
pawn Код:
command(spec, playerid, params[])                
{
    if(GetPlayerAdmin(playerid) < 1) return SendBlockedAdminCommand(playerid, 1);
    new id;
    if(!strlen(params)) return SendClientMessage(playerid,0xFF0000AA, "USAGE: /Spec [ID]");
    {
        id = strval(params);
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF0000AA, "Player not connected.");
        {
            if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFF0000AA, "You are not admin!");
            {
                TogglePlayerSpectating(playerid, 1);
                new string[50];
                format(string, sizeof(string), "Money: %d", GetPlayerMoney(id));
                GameTextForPlayer(playerid, string, 10000, 6);
                SpecTimer[playerid] = SetTimerEx("SpecUpdate", 3000, true, "ii", playerid, id);
                if(IsPlayerInAnyVehicle(id)) {
                    PlayerSpectateVehicle(playerid, GetPlayerVehicleID(id));
                    IsIn[playerid] = CAR;
                }
                else {
                    PlayerSpectatePlayer(playerid, id);
                    IsIn[playerid] = ONFOOT;
                }
            }
        }
    }
    return 1;
}

command(specoff,playerid, params[])
{
    if(GetPlayerAdmin(playerid) < 1) return SendBlockedAdminCommand(playerid, 1);
    #pragma unused params
    TogglePlayerSpectating(playerid, 0);
    return 1;
}
Reply
#2

Show us the "SpecUpdate" function.

EDIT: Try this.
pawn Код:
command(spec, playerid, params[])                
{
    if(GetPlayerAdmin(playerid) < 1) return SendBlockedAdminCommand(playerid, 1);
    new id;
    if(!strlen(params)) return SendClientMessage(playerid,0xFF0000AA, "USAGE: /Spec [ID]");
    {
        id = strval(params);
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF0000AA, "Player not connected.");
        {
            if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFF0000AA, "You are not admin!");
            {
                TogglePlayerSpectating(playerid, 1);
                SpecTimer[playerid] = SetTimerEx("SpecUpdate", 3000, true, "ii", playerid, id);
                if(IsPlayerInAnyVehicle(id))
                {
                    PlayerSpectateVehicle(playerid, GetPlayerVehicleID(id));
                    IsIn[playerid] = CAR;
                }
                else
                {
                    PlayerSpectatePlayer(playerid, id);
                    IsIn[playerid] = ONFOOT;
                }
                new string[50];
                format(string, sizeof(string), "Money: %d", GetPlayerMoney(id));
                GameTextForPlayer(playerid, string, 10000, 6);
                SpecTimer[playerid] = SetTimerEx("SpecUpdate", 3000, true, "ii", playerid, id);
            }
        }
    }
    return 1;
}

command(specoff,playerid, params[])
{
    #pragma unused params
    if(GetPlayerAdmin(playerid) < 1) return SendBlockedAdminCommand(playerid, 1);
    TogglePlayerSpectating(playerid, 0);
    SpawnPlayer(playerid);
    return 1;
}
Reply
#3

Na, still happens, and heres my SpecUpdate, thanks for helping btw.

pawn Код:
forward SpecUpdate(playerid, id);
public SpecUpdate(playerid, id)
{
    if(IsPlayerInAnyVehicle(id) && IsIn[playerid] != CAR) {
        PlayerSpectateVehicle(playerid, GetPlayerVehicleID(id));
        IsIn[playerid] = CAR;
    }
    else if(!IsPlayerInAnyVehicle(id) && IsIn[playerid] != ONFOOT) {
        PlayerSpectatePlayer(playerid, id);
        IsIn[playerid] = ONFOOT;
    }
    return 1;
}
Reply
#4

Not trying to be rude or anything, but if you're advanced enough in scripting to make your own spectating system, why are you still using older methods for param splitting/converting? sscanf is better for obvious reasons.
Reply
#5

bump, still have the same problem :/
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)