Spectating Textdraw
#1

Hello.
I have a NPC (which is use for testing such as /spec)
Now the problem is my Spectating Textdraw is not working fine

But my 1st textdraw is working fine (which is Player Info Textdraw)

Pawn Code:

pawn Код:
public OnPlayerConnect(playerid)
{
    InfoP[playerid] = TextDrawCreate(13.000000,427.000000,"Ping: Score:"); //this is working fine
    TextDrawBackgroundColor(InfoP[playerid],0x000000ff);
    TextDrawFont(InfoP[playerid],3);
    TextDrawLetterSize(InfoP[playerid],0.799999,1.900000);
    TextDrawColor(InfoP[playerid], COLOR_WHITE);
    TextDrawSetOutline(InfoP[playerid],1);
    TextDrawSetShadow(InfoP[playerid],1);
    SpecP[playerid] = TextDrawCreate(11.000000,235.000000," ");
    TextDrawAlignment(SpecP[playerid],0);
    TextDrawBackgroundColor(SpecP[playerid],0x000000ff);
    TextDrawFont(SpecP[playerid],1);
    TextDrawLetterSize(SpecP[playerid],0.699999,2.100000);
    TextDrawColor(SpecP[playerid],0xff0000ff);
    TextDrawSetOutline(SpecP[playerid],1);
    TextDrawSetShadow(SpecP[playerid],1);
    return 1;
}

public OnPlayerUpdate(playerid)
{
    new str[300];
    format(str, sizeof(str), "~y~Ping: ~w~%d ~r~Score: ~y~%d", GetPlayerPing(playerid), GetPlayerScore(playerid));
    TextDrawSetString(InfoP[playerid], str);
    format(str, sizeof(str), "~r~Now Spectating:~n~~w~%s~n~~y~Score: ~w~%d", GetpName(spectatorid[playerid]), GetPlayerScore(spectatorid[playerid]));
    TextDrawSetString(SpecP[playerid], str);
    return 1;
}

CMD:spec(playerid, params[])
{
    new str[128], id;
    if(pData[playerid][Login] == 0) return SendClientMessage(playerid, COLOR_RED, "*** Please login first! ***");
    if(pData[playerid][Admin] < 1) return SendClientMessage(playerid, COLOR_RED, "*** You are not Moderator ***");
    if(sscanf(params,"u", id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /spec [playerid]");
    if(id == playerid) return SendClientMessage(playerid, COLOR_RED,"*** You cannot spec yourself ***");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "*** Player not connected ***");
    if(IsSpecing[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"*** You are already specing someone ***");
    GetPlayerPos(playerid, SpecX[playerid], SpecY[playerid], SpecZ[playerid]);
    Inter[playerid] = GetPlayerInterior(playerid);
    vW[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);
    }
    format(str, sizeof(str), "*** You spectating %s(%d) ***", GetpName(id), id);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "*** Use /specoff to turn off spectating ***");
    TextDrawShowForPlayer(playerid, SpecP[playerid]);
    IsSpecing[playerid] = 1;
    IsBeingSpeced[id] = 1;
    spectatorid[playerid] = id;
    return 1;
}

CMD:specoff(playerid, params[])
{
    if(pData[playerid][Login] == 0) return SendClientMessage(playerid, COLOR_RED, "*** Please login first! ***");
    if(pData[playerid][Admin] < 1) return SendClientMessage(playerid, COLOR_RED, "*** You are not Moderator ***");
    if(IsSpecing[playerid] == 0) return SendClientMessage(playerid, COLOR_RED,"*** You are not spectating anyone ***");
    TogglePlayerSpectating(playerid, 0);
    TextDrawHideForPlayer(playerid, SpecP[playerid]);
    return 1;
}
Note: I'm using Tee's Spectating Tutorial
Reply


Messages In This Thread
Spectating Textdraw - by JaKe Elite - 19.05.2012, 12:25
Re: Spectating Textdraw - by Admigo - 19.05.2012, 13:23
Re: Spectating Textdraw - by JaKe Elite - 20.05.2012, 06:54
Re: Spectating Textdraw - by JaKe Elite - 20.05.2012, 07:52

Forum Jump:


Users browsing this thread: 1 Guest(s)