Senior Member
Join Date: Dec 2014
Location: Kyiv, Ukraine
08-27-2016
, 13:25
Compile errors
#1
Hey guys, i tryed to cut from one plugin a function, but somewhere i got mistakes and don't have any way to fix it.
Code:
Spoiler
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
new g_iIcon [ MAXPLAYERS + 1 ] = {- 1 , ...};
new const String : sModel [] = "materials\sprites\rank_x\1.vmt" ;
public OnMapStart ()
{
HookEvent ( "player_spawn" , Event_PlayerSpawn );
HookEvent ( "player_death" , Event_KillIcon );
HookEvent ( "player_team" , Event_KillIcon );
}
public Event_KillIcon ( Handle : hEvent , const String : sEvName [], bool : bDontBroadcast )
{
RemoveIcon ( GetClientOfUserId ( GetEventInt ( hEvent , "userid" )));
}
public Action : Event_PlayerSpawn ( Handle : event , const String : name [], bool : dontBroadcast )
{
for(new i = 1 ; i <= MaxClients ; i ++)
if( IsClientInGame ( i ))
{
RemoveIcon ( i );
CreateIcon ( i );
}
}
public OnClientConnected ( client )
{
decl String : sModel [ PLATFORM_MAX_PATH ];
GetNativeString ( 1 , sModel , sizeof ( sModel ));
PrecacheModel ( sModel );
}
RemoveIcon ( client )
{
if ( g_iIcon [ client ] != - 1 && IsValidEntity ( g_iIcon [ client ]))
{
//RemoveEdict(g_iIcon[client]);
AcceptEntityInput ( g_iIcon [ client ], "Kill" );
}
g_iIcon [ client ] = - 1 ;
}
public OnClientDisconnect ( client )
{
g_iIcon [ client ] = - 1 ;
}
public OnClientPutInServer ( client )
{
g_iIcon [ client ] = - 1 ;
}
CreateIcon ( client )
{
RemoveIcon ( client );
g_iIcon [ client ] = CreateEntityByName ( "env_sprite_oriented" );
if( g_iIcon [ client ] != - 1 )
{
DispatchKeyValue ( g_iIcon [ client ], "classname" , "env_sprite_oriented" );
DispatchKeyValue ( g_iIcon [ client ], "spawnflags" , "1" );
DispatchKeyValue ( g_iIcon [ client ], "scale" , "0.3" );
DispatchKeyValue ( g_iIcon [ client ], "rendermode" , "1" );
DispatchKeyValue ( g_iIcon [ client ], "rendercolor" , "255 255 255" );
decl String : sModel [ PLATFORM_MAX_PATH ];
GetNativeString ( 1 , sModel , sizeof ( sModel ));
DispatchKeyValue ( g_iIcon [ client ], "model" , sModel );
if( DispatchSpawn ( g_iIcon [ client ]))
{
decl Float : fPos [ 3 ];
GetClientAbsOrigin ( client , fPos );
fPos [ 2 ] += 90.0 ;
TeleportEntity ( g_iIcon [ client ], fPos , NULL_VECTOR , NULL_VECTOR );
SetVariantString ( "!activator" );
AcceptEntityInput ( g_iIcon [ client ], "SetParent" , client , g_iIcon [ client ]);
SetEntPropEnt ( g_iIcon [ client ], Prop_Send , "m_hOwnerEntity" , client );
SDKHook ( g_iIcon [ client ], SDKHook_SetTransmit , OnTransmit );
}
}
}
public Action : OnTransmit ( iEntity , client )
{
if ( g_iIcon [ client ] == iEntity )
{
return Plugin_Continue ;
}
static iOwner , iTeam ;
iTeam = GetClientTeam ( client );
if ( iTeam < 2 )
{
return Plugin_Continue ;
}
if (( iOwner = GetEntPropEnt ( iEntity , Prop_Send , "m_hOwnerEntity" )) > 0 && GetClientTeam ( iOwner ) != iTeam )
{
return Plugin_Handled ;
}
return Plugin_Continue ;
}
Errors:
Quote:
icon.sm(8) : error 027: invalid character constant
icon.sm(35) : warning 219: local variable "sModel" shadows a variable at a preceding level
icon.sm(74) : warning 219: local variable "sModel" shadows a variable at a preceding level
icon.sm(8) : warning 203: symbol is never used: "sModel"
Last edited by Kruzi; 08-27-2016 at 13:26 .