[POMOC] Opet spec -.-

Započeo William Johnson, Avgust 30, 2011, 18:00:44 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim: NX .. Al nebitno jer je ovo FS
Detaljan opis problema: Znaci ja bi da onaj textdraw samo dodje kad /speca i ne od sebe neg od specanog igraca..!!! Kako da to napravim?
Dio skripte:
Neke slike/video za lakse dobivanje pomoci(neobavezno):    http://www.zaslike.com/viewer.php?file=hhumiyuy4llmetyksg4.png





//  ADMIN SPECTATE FILTER SCRIPT
//  kyeman 2007
//

#pragma tabsize 0
#include <a_samp>
#include <core>
#include <float>

#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFFF

//------------------------------------------------------------------------------------------------------

#define ADMIN_SPEC_TYPE_NONE 0
#define ADMIN_SPEC_TYPE_PLAYER 1
#define ADMIN_SPEC_TYPE_VEHICLE 2

new gSpectateID[MAX_PLAYERS];
new gSpectateType[MAX_PLAYERS];
new Text:InfoTextDraw[MAX_PLAYERS][2], bool:isInfoTDCreated[MAX_PLAYERS], textdrawString[256];


//------------------------------------------------------------------------------------------------------

adminspec_strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}

new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}

//------------------------------------------------------------------------------------------------------


public OnFilterScriptInit()
{
    for(new u = 0; u < MAX_PLAYERS; u++)
{
    if(IsPlayerConnected(u)) CreatePlayerInfo(u);
}
    printf("-> Information textdraw filterscript v1.0 by Emilio \"korisnik uklonjen!\" Lovric  is loaded!");
    return true;
}

public OnFilterScriptExit()
{
    for(new u = 0; u < MAX_PLAYERS; u++)
{
    if(IsPlayerConnected(u)) DestroyPlayerInfo(u);
}
    printf("-> Information textdraw filterscript v1.0 by Emilio \"korisnik uklonjen!\" Lovric is unloaded!");
    return true;
}

public OnPlayerConnect(playerid)
{
    CreatePlayerInfo(playerid);
    return true;
}

public OnPlayerDisconnect(playerid, reason)
{
    DestroyPlayerInfo(playerid);
    return true;
}

public OnPlayerUpdate(playerid)
{
format(textdrawString, 256,
"~g~Information:\
~n~~r~Name: ~y~%s\
~n~~r~IP: ~y~%s\
~n~~r~Ping: ~y~%i\
~n~~r~Health: ~y~%i\
~n~~r~Armor: ~y~%i\
~n~~r~State: ~y~%s\
~n~~r~Money: ~y~$%i,00",
PlayerName(playerid),
PlayerIp(playerid),
GetPlayerPing(playerid),
PlayerHealth(playerid),
PlayerArmor(playerid),
PlayerStateName(playerid),
GetPlayerMoney(playerid));
UpdatePlayerInfo(0, playerid, textdrawString);
return true;
}

stock CreatePlayerInfo(playerid)
{
// first text-draw.
InfoTextDraw[playerid][0] = TextDrawCreate(10.000000, 132.000000, "Information textdraw 1");
TextDrawTextSize(InfoTextDraw[playerid][0], 605.000000, 0.000000);
TextDrawAlignment(InfoTextDraw[playerid][0], 0);
TextDrawBackgroundColor(InfoTextDraw[playerid][0], 0x000000ff);
TextDrawFont(InfoTextDraw[playerid][0], 1);
TextDrawLetterSize(InfoTextDraw[playerid][0], 0.299999, 1.000000);
TextDrawColor(InfoTextDraw[playerid][0], 0x00ffffff);
TextDrawSetProportional(InfoTextDraw[playerid][0], 1);
TextDrawSetShadow(InfoTextDraw[playerid][0], 1);
// second text-draw.
InfoTextDraw[playerid][1] = TextDrawCreate(10.000000, 132.000000, "Information textdraw 2");
TextDrawTextSize(InfoTextDraw[playerid][1], 605.000000, 0.000000);
TextDrawAlignment(InfoTextDraw[playerid][1], 0);
TextDrawBackgroundColor(InfoTextDraw[playerid][1], 0x000000ff);
TextDrawFont(InfoTextDraw[playerid][1], 1);
TextDrawLetterSize(InfoTextDraw[playerid][1], 0.299999, 1.000000);
TextDrawColor(InfoTextDraw[playerid][1], 0x00ffffff);
TextDrawSetProportional(InfoTextDraw[playerid][1], 1);
TextDrawSetShadow(InfoTextDraw[playerid][1], 1);
isInfoTDCreated[playerid] = true;
return true;
}

stock DestroyPlayerInfo(playerid)
{
if(isInfoTDCreated[playerid] == true)
{
TextDrawDestroy(InfoTextDraw[playerid][0]);
TextDrawDestroy(InfoTextDraw[playerid][1]);
    isInfoTDCreated[playerid] = false;
}
return true;
}

stock ShowPlayerInfo(playerid)
{
TextDrawShowForPlayer(playerid, InfoTextDraw[playerid][0]);
TextDrawShowForPlayer(playerid, InfoTextDraw[playerid][1]);
return true;
}

stock HidePlayerInfo(playerid)
{
TextDrawHideForPlayer(playerid, InfoTextDraw[playerid][0]);
TextDrawHideForPlayer(playerid, InfoTextDraw[playerid][1]);
return true;
}

stock UpdatePlayerInfo(id, playerid, content[])
{
if(isInfoTDCreated[playerid] == true)
{
    if(id == 0 || id == 1)
    {
TextDrawSetString(InfoTextDraw[playerid][id], content);
TextDrawShowForPlayer(playerid, InfoTextDraw[playerid][id]);
}
return false;
}
return true;
}

/*----------------------------------------------------------------------------*/

stock PlayerName(playerid)
{
    new
name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}

stock PlayerIp(playerid)
{
    new
ip[16];
    GetPlayerIp(playerid, ip, sizeof(ip));
    return ip;
}

stock PlayerHealth(playerid)
{
    new
Float:health;
    GetPlayerHealth(playerid, health);
    return floatround(health);
}

stock PlayerArmor(playerid)
{
    new
Float:armor;
    GetPlayerArmour(playerid, armor);
    return floatround(armor);
}

stock PlayerStateName(playerid)
{
new
statename[32];
switch(GetPlayerState(playerid))
{
    case PLAYER_STATE_NONE: statename = "on foot";
case PLAYER_STATE_ONFOOT: statename = "on foot";
    case PLAYER_STATE_DRIVER: statename = "driver in the vehicle";
    case PLAYER_STATE_PASSENGER: statename = "passenger in the vehicle";
    case PLAYER_STATE_WASTED: statename = "wasted";
    case PLAYER_STATE_SPAWNED: statename = "spawned";
    case PLAYER_STATE_SPECTATING: statename = "spectating";
default: statename = "unknown state";
}
return statename;
}
//------------------------------------------------------------------------------------------------------

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
// IF ANYONE IS SPECTATING THIS PLAYER, WE'LL ALSO HAVE
// TO CHANGE THEIR INTERIOR ID TO MATCH
new x = 0;
while(x!=MAX_PLAYERS) {
    if( IsPlayerConnected(x) && GetPlayerState(x) == PLAYER_STATE_SPECTATING &&
gSpectateID[x] == playerid && gSpectateType[x] == ADMIN_SPEC_TYPE_PLAYER )
    {
        SetPlayerInterior(x,newinteriorid);
}
x++;
}
}

//------------------------------------------------------------------------------------------------------

public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new specplayerid, specvehicleid, idx;


// WE ONLY DEAL WITH COMMANDS FROM ADMINS IN THIS FILTERSCRIPT
    if(!IsPlayerAdmin(playerid)) return 0;

cmd = adminspec_strtok(cmdtext, idx);

// SPECTATE A PLAYER
    if(strcmp(cmd, "/specplayer", true) == 0) {
       new tmp[256];
       tmp = adminspec_strtok(cmdtext, idx);

      if(!strlen(tmp)) {
         SendClientMessage(playerid, COLOR_WHITE, "USAGE: /specplayer [playerid]");
         return 1;
      }
      specplayerid = strval(tmp);

      if(!IsPlayerConnected(specplayerid)) {
         SendClientMessage(playerid, COLOR_RED, "specplayer: that player isn't active.");
         return 1;
      }

      TogglePlayerSpectating(playerid, 1);
      PlayerSpectatePlayer(playerid, specplayerid);
      SetPlayerInterior(playerid,GetPlayerInterior(specplayerid));
      gSpectateID[playerid] = specplayerid;
      gSpectateType[playerid] = ADMIN_SPEC_TYPE_PLAYER;
      TextDrawShowForPlayer(playerid, InfoTextDraw[playerid][0]);
      TextDrawShowForPlayer(playerid, InfoTextDraw[playerid][1]);
      return 1;
   }

// SPECTATE A VEHICLE
if(strcmp(cmd, "/specvehicle", true) == 0) {
    new tmp[256];
tmp = adminspec_strtok(cmdtext, idx);

if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /specvehicle [vehicleid]");
return 1;
}
specvehicleid = strval(tmp);

if(specvehicleid < MAX_VEHICLES) {
TogglePlayerSpectating(playerid, 1);
PlayerSpectateVehicle(playerid, specvehicleid);
gSpectateID[playerid] = specvehicleid;
gSpectateType[playerid] = ADMIN_SPEC_TYPE_VEHICLE;
}
return 1;
}

// STOP SPECTATING
if(strcmp(cmd, "/specoff", true) == 0) {
TogglePlayerSpectating(playerid, 0);
gSpectateID[playerid] = INVALID_PLAYER_ID;
gSpectateType[playerid] = ADMIN_SPEC_TYPE_NONE;
return 1;
}

return 0;
}

//------------------------------------------------------------------------------------------------------
Poslednja Izmena: Avgust 30, 2011, 18:16:45 POSLE PODNE od William Johnson

format(textdrawString, 256,
      "~g~Information:\
       ~n~~r~Name: ~y~%s\
       ~n~~r~IP: ~y~%s\
       ~n~~r~Ping: ~y~%i\
       ~n~~r~Health: ~y~%i\
       ~n~~r~Armor: ~y~%i\
       ~n~~r~State: ~y~%s\
       ~n~~r~Money: ~y~$%i,00",
         PlayerName(playerid),
         PlayerIp(playerid),
         GetPlayerPing(playerid),
         PlayerHealth(playerid),
         PlayerArmor(playerid),
         PlayerStateName(playerid),
         GetPlayerMoney(playerid));

samo ovo playerid promjeni ... playerid je,kako da ti kazem...subjekat ili kako vec...to pokazuje osobu koja je
koristila komandu
dakle playerid promjeni u nesto drugo sto ti oznacava "objekat" :)

//delete
Poslednja Izmena: Avgust 31, 2011, 15:26:55 POSLE PODNE od [GG] Fox