[POMOC] Specanje

30. Avg. 2011. Zaključano
2,182
pregleda
30
postova
William Johnson
3
Hustler
30. Avg. 2011.
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
#include
#include

#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;
new gSpectateType;
new Text:InfoTextDraw, bool:isInfoTDCreated, textdrawString;

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

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

new offset = index;
new result;
while ((index < length) && (string > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string;
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 = TextDrawCreate(10.000000, 132.000000, "Information textdraw 1");
TextDrawTextSize(InfoTextDraw, 605.000000, 0.000000);
TextDrawAlignment(InfoTextDraw, 0);
TextDrawBackgroundColor(InfoTextDraw, 0x000000ff);
TextDrawFont(InfoTextDraw, 1);
TextDrawLetterSize(InfoTextDraw, 0.299999, 1.000000);
TextDrawColor(InfoTextDraw, 0x00ffffff);
TextDrawSetProportional(InfoTextDraw, 1);
TextDrawSetShadow(InfoTextDraw, 1);
// second text-draw.
InfoTextDraw = TextDrawCreate(10.000000, 132.000000, "Information textdraw 2");
TextDrawTextSize(InfoTextDraw, 605.000000, 0.000000);
TextDrawAlignment(InfoTextDraw, 0);
TextDrawBackgroundColor(InfoTextDraw, 0x000000ff);
TextDrawFont(InfoTextDraw, 1);
TextDrawLetterSize(InfoTextDraw, 0.299999, 1.000000);
TextDrawColor(InfoTextDraw, 0x00ffffff);
TextDrawSetProportional(InfoTextDraw, 1);
TextDrawSetShadow(InfoTextDraw, 1);
isInfoTDCreated = true;
return true;
}

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

stock ShowPlayerInfo(playerid)
{
TextDrawShowForPlayer(playerid, InfoTextDraw);
TextDrawShowForPlayer(playerid, InfoTextDraw);
return true;
}

stock HidePlayerInfo(playerid)
{
TextDrawHideForPlayer(playerid, InfoTextDraw);
TextDrawHideForPlayer(playerid, InfoTextDraw);
return true;
}

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

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

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

stock PlayerIp(playerid)
{
   new
ip;
   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;
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 == playerid && gSpectateType == ADMIN_SPEC_TYPE_PLAYER )
  {
     SetPlayerInterior(x,newinteriorid);
}
x++;
}
}

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

public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd;
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;
tmp = adminspec_strtok(cmdtext, idx);

if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /specplayer ");
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 = specplayerid;
gSpectateType = ADMIN_SPEC_TYPE_PLAYER;

return 1;
}

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

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

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

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

return 0;
}

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

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

by L84S
GGC
5
Godfather
30. Avg. 2011.
Nisi pokazao(ShowPlayerTextDraw) kod komandi + Bolje ti je koristit OnFilterScriptInit umjesto CreatePlayerInfo.. jednostavnije.
William Johnson
3
Hustler
30. Avg. 2011.
Gdje da ubacim to ShowPlayerTextDraw??
GGC
5
Godfather
30. Avg. 2011.
Pod komandu omg 😄
William Johnson
3
Hustler
30. Avg. 2011.
Ovak ili?
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd;
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;
tmp = adminspec_strtok(cmdtext, idx);

if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /specplayer ");
return 1;
}
DeFox
5
Underboss
30. Avg. 2011.
// SPECTATE A PLAYER
if(strcmp(cmd, "/specplayer", true) == 0) {
    new tmp;
tmp = adminspec_strtok(cmdtext, idx);

if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /specplayer ");
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 = specplayerid;
gSpectateType = ADMIN_SPEC_TYPE_PLAYER;
                TextDrawShowForPlayer(playerid, IME_TEXTDRAWA);

return 1;
}
William Johnson
3
Hustler
30. Avg. 2011.
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.
[BWW] nåяcо
4
Enforcer
30. Avg. 2011.
William Johnson wrote on August 30, 2011, 1:22 pm:
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
William Johnson
3
Hustler
30. Avg. 2011.
Et probo i opet mi izbaci druge errore sad sam opet sve undo :S
Partybreaker
4
Enforcer
30. Avg. 2011.
Pa trebao si postati koje ti je errore izbacao.
William Johnson
3
Hustler
30. Avg. 2011.
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;
Deleted User
Obrisan korisnik
30. Avg. 2011.
William Johnson wrote on August 30, 2011, 1:51 pm:
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;
William Johnson
3
Hustler
30. Avg. 2011.
Pa neznam sta tu nevalja o.O
Deleted User
Obrisan korisnik
30. Avg. 2011.
William Johnson wrote on August 30, 2011, 1:59 pm:
Pa neznam sta tu nevalja o.O

Nisi poravnao, zato ti warninge izbacuje
William Johnson
3
Hustler
30. Avg. 2011.
Pa popravio bi ja da znam kako..! Ocel radit komanda zbog warninga??

Morate biti prijavljeni da biste odgovorili na ovu temu.

Prijava

© 2026 SmartShark. All rights reserved.

Powered by Momentum|v2026.3.001 Alpha