06.04.2012, 23:12
if i go on spec someone i dont see health and the things.. you know..i hope you see
i added this
PHP код:
public Spectator()
{
new string[350];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(Spectate[i] != 255)
{
new targetid = Spectate[i];
if(IsPlayerConnected(targetid))
{
if(PlayerInfo[i][pAdmin] >= 1)
{
new Float:health,Float:armour,Float:health2;
new name[MAX_PLAYER_NAME];
new money = GetPlayerMoney(targetid);
new carid = GetPlayerVehicleID(targetid);
new bankmoney = PlayerInfo[targetid][pAccount];
GetPlayerName(targetid, name, sizeof(name));
GetPlayerHealth(targetid, health);
GetPlayerArmour(targetid, armour);
GetVehicleHealth(carid, health2);
if(!IsPlayerInAnyVehicle(targetid))
{
format(string, sizeof(string),"~p~- ~h~%s (ID: %d) ~p~-~n~~n~~n~ ~b~Health: ~w~%.1f ~g~:-: ~b~Armour: ~w~%.1f ~n~ ~b~Money: ~w~$%d ~g~:-: ~b~Bank: ~w~$%d",name,targetid,health,armour,money,bankmoney);
TextDrawSetString(Textdraw54[i],string);
}
else
{
format(string, sizeof(string),"~p~- ~h~%s (ID: %d) ~p~-~n~~n~~n~ ~b~Health: ~w~%.1f ~g~:-: ~b~Armour: ~w~%.1f ~n~ ~b~Money: ~w~$%d ~g~:-: ~b~Bank: ~w~$%d ~n~~n~~g~---------------------------------------------------~n~~n~ ~b~Vehicle ID: ~w~%d ~b~Vehicle HP: ~w~%.1f ~n~~n~",name,targetid,health,armour,money,bankmoney,carid,health2);
TextDrawSetString(Textdraw54[i],string);
}
}
if(GetPlayerVirtualWorld(targetid) > 0)
{
SetPlayerVirtualWorld(i,GetPlayerVirtualWorld(targetid));
}
}//Targetid connected
}
}
}
}
PHP код:
Textdraw54[playerid] = TextDrawCreate(331.000000, 340.000000, " "); // Spectate
TextDrawAlignment(Textdraw54[playerid], 2);
TextDrawBackgroundColor(Textdraw54[playerid], 255);
TextDrawFont(Textdraw54[playerid], 1);
TextDrawLetterSize(Textdraw54[playerid], 0.500000, 1.000000);
TextDrawColor(Textdraw54[playerid], -1);
TextDrawSetOutline(Textdraw54[playerid], 0);
TextDrawSetProportional(Textdraw54[playerid], 1);
TextDrawSetShadow(Textdraw54[playerid], 0);
PHP код:
if(strcmp(cmd, "/spectate", true) == 0)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /spectate [playerid]");
return 1;
}
specplayerid = strval(tmp);
if(!IsPlayerConnected(specplayerid)) {
SendClientMessage(playerid, COLOR_RED, "SpectatePlayer: That player isn't active.");
return 1;
}
tmp = strtok(cmdtext, idx);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, specplayerid);
TextDrawShowForPlayer(playerid, Textdraw54[playerid]);
SetPlayerInterior(playerid,GetPlayerInterior(specplayerid));
gSpectateID[playerid] = specplayerid;
gSpectateType[playerid] = ADMIN_SPEC_TYPE_PLAYER;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
}
}
}
return 1;
}