spec textdraw shows my own info
#1

I need help with fixing this. I am using textdraws to get players information when using /spectate on them, but whenever i use it, it shows my own information, i am trying to figure this out, but it only increases the amount of bugs.
here's the code:

pawn Код:
forward AdminSpectate(playerid);
public AdminSpectate(playerid) // Timer update
{
    new id;
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Player Not Connected.");
    {
    new Name[MAX_PLAYER_NAME], ip[16], tdstring[128];
    new Float:health, Float:armour;
    GetPlayerName(id, Name, sizeof(Name));
    GetPlayerHealth(id, health);
    GetPlayerArmour(id, armour);
    GetPlayerIp(id, ip, 16);
    format(tdstring, sizeof(tdstring), "Name: %s", Name);
    TextDrawSetString(Textdraw0[id], tdstring);
    format(tdstring, sizeof(tdstring), "Health: %.0f", health);
    TextDrawSetString(Textdraw111[id], tdstring);
    format(tdstring, sizeof(tdstring), "Armor: %.0f", armour);
    TextDrawSetString(Textdraw2[id], tdstring);
    format(tdstring, sizeof(tdstring), "Ping: %d", GetPlayerPing(id));
    TextDrawSetString(Textdraw3[id], tdstring);
    format(tdstring, sizeof(tdstring), "IP: %s", ip);
    TextDrawSetString(Textdraw5[id], tdstring);
    format(tdstring, sizeof(tdstring), "Money: $%d", GetPlayerMoney(id));
    TextDrawSetString(Textdraw6[id], tdstring);
    }
    return 1;
}

CMD:spec
{
    Spectating[playerid] = id;
    TogglePlayerSpectating(playerid, 1);
    new Name[MAX_PLAYER_NAME], ip[16], tdstring[128];
    new Float:health, Float:armour;
    GetPlayerName(id, Name, sizeof(Name));
    GetPlayerHealth(id, health);
    GetPlayerArmour(id, armour);
    GetPlayerIp(id, ip, 16);
    new png = GetPlayerPing(id);
    TextDrawShowForPlayer(playerid, Textdraw3[playerid]);
    TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
    TextDrawShowForPlayer(playerid, Textdraw44[playerid]);
    TextDrawShowForPlayer(playerid, Textdraw7[playerid]);
    TextDrawShowForPlayer(playerid, Textdraw8[playerid]);
    TextDrawShowForPlayer(playerid, Textdraw9[playerid]);
    TextDrawShowForPlayer(playerid, Textdraw10[playerid]);
    TextDrawShowForPlayer(playerid, Textdraw111[playerid]);
    TextDrawShowForPlayer(playerid, Textdraw2[playerid]);
    TextDrawShowForPlayer(playerid, Textdraw5[playerid]);
    format(tdstring, sizeof(tdstring), "Name: %s", Name);
    TextDrawSetString(Textdraw0[id], tdstring);
    format(tdstring, sizeof(tdstring), "Health: %.0f", health);
    TextDrawSetString(Textdraw111[id], tdstring);
    format(tdstring, sizeof(tdstring), "Armor: %.0f", armour);
    TextDrawSetString(Textdraw2[id], tdstring);
    format(tdstring, sizeof(tdstring), "Ping: %d", png);
    TextDrawSetString(Textdraw3[id], tdstring);
    format(tdstring, sizeof(tdstring), "IP: %s", ip);
    TextDrawSetString(Textdraw5[id], tdstring);
    format(tdstring, sizeof(tdstring), "Money: $%i", GetPlayerMoney(id));
    TextDrawShowForPlayer(playerid, Textdraw6[playerid]);
    TextDrawSetString(Textdraw6[id], tdstring);
        PlayerSpectatePlayer(playerid, id);
}
I have AdminSpectate timer OnGameModeInit, glad if anyone could help
Reply


Messages In This Thread
spec textdraw shows my own info - by GwENiko - 14.06.2014, 21:00
Re: spec textdraw shows my own info - by GwENiko - 15.06.2014, 00:45
Re: spec textdraw shows my own info - by Laure - 15.06.2014, 00:52
Re: spec textdraw shows my own info - by GwENiko - 15.06.2014, 01:49
Re: spec textdraw shows my own info - by DavidBilla - 15.06.2014, 02:03
Re: spec textdraw shows my own info - by AiRaLoKa - 15.06.2014, 02:32
Re: spec textdraw shows my own info - by Threshold - 15.06.2014, 05:09

Forum Jump:


Users browsing this thread: 2 Guest(s)