Raised This Month: $51 Target: $400
 12% 

Compile errors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kruzi
Senior Member
Join Date: Dec 2014
Location: Kyiv, Ukraine
Old 08-27-2016 , 13:25   Compile errors
Reply With Quote #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


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.
Kruzi is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 08-27-2016 , 14:27   Re: Compile errors
Reply With Quote #2

Удали строки 35 и 74: У тебя уже имеется глобальная переменная в 8-й строке с этим же именем.
И вместо
PHP Code:
new const String:sModel[] = "materials\sprites\rank_x\1.vmt"
имеет смысл использовать
PHP Code:
#define sModel "materials\sprites\rank_x\1.vmt" 
You need delete lines 35 and 74: You already have a global variable in the 8th line with the same name.
And instead of
PHP Code:
new const String:sModel[] = "materials\sprites\rank_x\1.vmt"
makes sense to use
PHP Code:
#define sModel "materials\sprites\rank_x\1.vmt" 
__________________
Grey83 is offline
Kruzi
Senior Member
Join Date: Dec 2014
Location: Kyiv, Ukraine
Old 08-27-2016 , 15:39   Re: Compile errors
Reply With Quote #3

Quote:
Originally Posted by grey83 View Post
Удали строки 35 и 74: У тебя уже имеется глобальная переменная в 8-й строке с этим же именем.
И вместо
PHP Code:
new const string:smodel[] = "materials\sprites\rank_x\1.vmt"
имеет смысл использовать
PHP Code:
#define smodel "materials\sprites\rank_x\1.vmt" 
you need delete lines 35 and 74: You already have a global variable in the 8th line with the same name.
And instead of
PHP Code:
new const string:smodel[] = "materials\sprites\rank_x\1.vmt"
makes sense to use
PHP Code:
#define smodel "materials\sprites\rank_x\1.vmt" 
Не помогло
Kruzi is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 08-27-2016 , 18:49   Re: Compile errors
Reply With Quote #4

попробуй так:
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

#define sModel "materials/sprites/rank_x/1.vmt"

new g_iIcon[MAXPLAYERS+1] = {-1, ...};

public 
OnMapStart()
{
    
PrecacheModel(sModeltrue);
    
HookEvent("player_spawn"Event_PlayerSpawn);
    
HookEvent("player_death"Event_KillIcon);
    
HookEvent("player_team"Event_KillIcon);
}

public 
Action:Event_KillIcon(Handle:event, const String:name[], bool:dontBroadcast)
{
    
RemoveIcon(GetClientOfUserId(GetEventInt(event"userid")));
}

public 
Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    
CreateIcon(GetClientOfUserId(GetEventInt(event"userid")));
}

public 
OnClientConnected(client)
{
    
g_iIcon[client] = -1;
}

public 
OnClientDisconnect(client)
{
    
RemoveIcon(client);
}

RemoveIcon(client)
{
    if (
g_iIcon[client] != -&& IsValidEntity(g_iIcon[client]))
        
AcceptEntityInput(g_iIcon[client], "Kill");
    
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");
        
DispatchKeyValue(g_iIcon[client], "model"sModel);
        if(
DispatchSpawn(g_iIcon[client]))
        {
            
decl Float:fPos[3];
            
GetClientAbsOrigin(clientfPos);
            
fPos[2] += 90.0;
            
TeleportEntity(g_iIcon[client], fPosNULL_VECTORNULL_VECTOR);

            
SetVariantString("!activator");
            
AcceptEntityInput(g_iIcon[client], "SetParent"clientg_iIcon[client]);

            
SetEntPropEnt(g_iIcon[client], Prop_Send"m_hOwnerEntity"client);

            
SDKHook(g_iIcon[client], SDKHook_SetTransmitOnTransmit);
        }
    }
}

public 
Action:OnTransmit(iEntityclient)
{
    if (
g_iIcon[client] == iEntity) return Plugin_Continue;

    static 
iOwneriTeam;

    
iTeam GetClientTeam(client);

    if (
iTeam 2) return Plugin_Continue;
    
iOwner GetEntPropEnt(iEntityProp_Send"m_hOwnerEntity");
    if (
iOwner && GetClientTeam(iOwner) != iTeam) return Plugin_Handled;

    return 
Plugin_Continue;

__________________
Grey83 is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 08-27-2016 , 18:51   Re: Compile errors
Reply With Quote #5

English only please
__________________
WildCard65 is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 08-28-2016 , 04:08   Re: Compile errors
Reply With Quote #6

Quote:
Originally Posted by WildCard65 View Post
English only please
Quote:
Originally Posted by Grey83 View Post
попробуй так:
= 'try this:'
__________________
Grey83 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:30.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode