[POMOC] Specanje

Započeo William Johnson, Avgust 30, 2011, 13:04:07 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim: Nebitno jer je ovo FS
Detaljan opis problema: Ja sam u FS Spec ubacio jos ovog da se vidi kolko hp ima itd al kasd ga specam nista ne pokaze samo ga speca al nepise sa strane hp : armor : speed: itd, i kako da napravim da admin lvl 1 ili veci admin specat?
Dio skripte: /
Neke slike/video za lakse dobivanje pomoci(neobavezno): /

//  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;

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;
}

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

Moderator: dodan prefix iduci put ce tema biti Lockana[ ]

by L84S
Poslednja Izmena: Avgust 30, 2011, 17:11:15 POSLE PODNE od [TG]$--L84S--$

Nisi pokazao(ShowPlayerTextDraw) kod komandi + Bolje ti je koristit OnFilterScriptInit umjesto CreatePlayerInfo.. jednostavnije.
Aequam memento rebus in arduis servare mentem.

Gdje da ubacim to ShowPlayerTextDraw??

Pod komandu omg :D
Aequam memento rebus in arduis servare mentem.

Ovak ili?

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

// 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;
}


// 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, IME_TEXTDRAWA);

      return 1;
   }

izbacuje 1 error i 4 warninga




C:\Users\Mario Sokic\Desktop\Balkan Omega Mod 2\filterscripts\spec.pwn(253) : warning 217: loose indentation
C:\Users\Mario Sokic\Desktop\Balkan Omega Mod 2\filterscripts\spec.pwn(263) : warning 217: loose indentation
C:\Users\Mario Sokic\Desktop\Balkan Omega Mod 2\filterscripts\spec.pwn(271) : warning 217: loose indentation
C:\Users\Mario Sokic\Desktop\Balkan Omega Mod 2\filterscripts\spec.pwn(271) : error 017: undefined symbol "IME_TEXTDRAWA"
C:\Users\Mario Sokic\Desktop\Balkan Omega Mod 2\filterscripts\spec.pwn(273) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.


Citat: William Johnson poslato Avgust 30, 2011, 15:22:15 POSLE PODNE
izbacuje 1 error i 4 warninga




C:\Users\Mario Sokic\Desktop\Balkan Omega Mod 2\filterscripts\spec.pwn(253) : warning 217: loose indentation
C:\Users\Mario Sokic\Desktop\Balkan Omega Mod 2\filterscripts\spec.pwn(263) : warning 217: loose indentation
C:\Users\Mario Sokic\Desktop\Balkan Omega Mod 2\filterscripts\spec.pwn(271) : warning 217: loose indentation
C:\Users\Mario Sokic\Desktop\Balkan Omega Mod 2\filterscripts\spec.pwn(271) : error 017: undefined symbol "IME_TEXTDRAWA"
C:\Users\Mario Sokic\Desktop\Balkan Omega Mod 2\filterscripts\spec.pwn(273) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.



definisi taj textdraw i poravnaj te linije i popravit ces warninge
Vratio sam se ponovo ocekjute novi server...

Et probo i opet mi izbaci druge errore sad sam opet sve undo :S

Pa trebao si postati koje ti je errore izbacao.


Server IP: 193.192.58.82:7782
Forum: www.balkan-underline.info


ma msm nije mi uopce erorre izbacilo neg je crashao compiler :S

EDIT: evo uspjeo sam al opet imaju 4 warninga


C:\Users\Mario Sokic\Desktop\Balkan Omega Mod 2\filterscripts\spec.pwn(254) : warning 217: loose indentation
C:\Users\Mario Sokic\Desktop\Balkan Omega Mod 2\filterscripts\spec.pwn(264) : warning 217: loose indentation
C:\Users\Mario Sokic\Desktop\Balkan Omega Mod 2\filterscripts\spec.pwn(272) : warning 213: tag mismatch
C:\Users\Mario Sokic\Desktop\Balkan Omega Mod 2\filterscripts\spec.pwn(274) : warning 217: loose indentation
Pawn compiler 3.2.3664           Copyright (c) 1997-2006, ITB CompuPhase


254: tmp = adminspec_strtok(cmdtext, idx);
264: return 1;
272:  TextDrawShowForPlayer(playerid, IME_TEXTDRAWA);
274:   return 1;
Poslednja Izmena: Avgust 30, 2011, 15:54:02 POSLE PODNE od William Johnson

[BUL]Salvatore

Citat: William Johnson poslato Avgust 30, 2011, 15:51:46 POSLE PODNE
ma msm nije mi uopce erorre izbacilo neg je crashao compiler :S

EDIT: evo uspjeo sam al opet imaju 4 warninga


C:\Users\Mario Sokic\Desktop\Balkan Omega Mod 2\filterscripts\spec.pwn(254) : warning 217: loose indentation
C:\Users\Mario Sokic\Desktop\Balkan Omega Mod 2\filterscripts\spec.pwn(264) : warning 217: loose indentation
C:\Users\Mario Sokic\Desktop\Balkan Omega Mod 2\filterscripts\spec.pwn(272) : warning 213: tag mismatch
C:\Users\Mario Sokic\Desktop\Balkan Omega Mod 2\filterscripts\spec.pwn(274) : warning 217: loose indentation
Pawn compiler 3.2.3664           Copyright (c) 1997-2006, ITB CompuPhase


254: tmp = adminspec_strtok(cmdtext, idx);
264: return 1;
272:  TextDrawShowForPlayer(playerid, IME_TEXTDRAWA);
274:   return 1;
Pa poravnaj linije:
tmp = adminspec_strtok(cmdtext, idx);
return 1;
TextDrawShowForPlayer(playerid, IME_TEXTDRAWA);
return 1;


[BUL]Salvatore


Pa popravio bi ja da znam kako..! Ocel radit komanda zbog warninga??