PDA

View Full Version : [CS GO] Undefined Symbol


Sn3amtz
04-09-2015, 08:29
Can someone identified this?

public FreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 0.0);
SetEntityRenderColor(attacker, 255, 0, 170, 174);
}

public UnFreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 1.0);
SetEntityRenderColor(attacker, 255, 255, 255, 255);
}

/groups/sourcemod/upload_tmp/textYvjYSQ.sp(31) : warning 217: loose indentation
/groups/sourcemod/upload_tmp/textYvjYSQ.sp(31) : error 029: invalid expression, assumed zero
/groups/sourcemod/upload_tmp/textYvjYSQ.sp(31) : error 017: undefined symbol "FreezePlayer"
/groups/sourcemod/upload_tmp/textYvjYSQ.sp(37) : error 029: invalid expression, assumed zero
/groups/sourcemod/upload_tmp/textYvjYSQ.sp(37) : error 017: undefined symbol "UnFreezePlayer"
/groups/sourcemod/upload_tmp/textYvjYSQ.sp(45) : warning 217: loose indentation

8guawong
04-09-2015, 08:40
change client to attacker


public FreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 0.0);
SetEntityRenderColor(attacker, 255, 0, 170, 174);
}

public UnFreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 1.0);
SetEntityRenderColor(attacker, 255, 255, 255, 255);
}

Sn3amtz
04-09-2015, 08:54
OK my bad ... But i need to To identyfied symbol FreezePlayer and UnFreezePlayer

KissLick
04-09-2015, 08:59
Wrong section -> https://forums.alliedmods.net/forumdisplay.php?f=107

btw. why do you define your functions as a public ?

Sn3amtz
04-09-2015, 09:04
Can someone identified this?

public FreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 0.0);
SetEntityRenderColor(attacker, 255, 0, 170, 174);
}

public UnFreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 1.0);
SetEntityRenderColor(attacker, 255, 255, 255, 255);
}

/groups/sourcemod/upload_tmp/textYvjYSQ.sp(31) : warning 217: loose indentation
/groups/sourcemod/upload_tmp/textYvjYSQ.sp(31) : error 029: invalid expression, assumed zero
/groups/sourcemod/upload_tmp/textYvjYSQ.sp(31) : error 017: undefined symbol "FreezePlayer"
/groups/sourcemod/upload_tmp/textYvjYSQ.sp(37) : error 029: invalid expression, assumed zero
/groups/sourcemod/upload_tmp/textYvjYSQ.sp(37) : error 017: undefined symbol "UnFreezePlayer"
/groups/sourcemod/upload_tmp/textYvjYSQ.sp(45) : warning 217: loose indentation

KissLick
04-09-2015, 09:12
Why that public keyword? Your functions don't look like a callbacks.

btw. this compiles ok

#pragma semicolon 1

#include <sourcemod>

public Plugin:myinfo = {
name = "",
author = "",
description = "",
version = "0.0.0",
url = ""
};

public FreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 0.0);
SetEntityRenderColor(attacker, 255, 0, 170, 174);
}

public UnFreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 1.0);
SetEntityRenderColor(attacker, 255, 255, 255, 255);
}

Sn3amtz
04-09-2015, 09:27
can u make this?

#pragma semicolon 1
#include <sourcemod>
#include <sdkhooks>
#include <cstrike>

public OnClientPutInServer(client){
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}

public OnClientDisconnect(client){
SDKUnhook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}

public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype){
if(victim <= 0 && victim > MaxClients){ return Plugin_Continue; }
if(attacker <= 0 || attacker > MaxClients){ return Plugin_Continue; }
if(damage > 66.0){
new String:wep[64];GetClientWeapon(attacker, wep, sizeof(wep));
if(StrEqual(wep, "weapon_knife", false)){
PrintToChat(attacker, "\x01[KNIFE]\x04 Backstab blocked!");
ClientCommand(attacker, "play *training/timer_bell.wav");
damage = 0.0;

public FreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 0.0);
SetEntityRenderColor(attacker, 255, 0, 170, 174);
}

public UnFreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 1.0);
SetEntityRenderColor(attacker, 255, 255, 255, 255);
}
return Plugin_Changed;
}
}
return Plugin_Continue;
}

8guawong
04-09-2015, 09:39
nvm
your brackets are wrong

Powerlord
04-09-2015, 09:41
So.... you're trying to define functions within other functions?

Pretty sure SourcePawn doesn't allow that.

Sn3amtz
04-09-2015, 09:44
can u make to get attacker rcon action? sm_slap sm_freeze....

KissLick
04-09-2015, 09:56
As Powerlord said... move FreezePlayer and UnFreezePlayer outside the OnTakeDamage.
Btw there is no need to define them as public.

like:

#pragma semicolon 1
#include <sourcemod>
#include <sdkhooks>
#include <cstrike>

public OnClientPutInServer(client){
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}

public OnClientDisconnect(client){
SDKUnhook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}

FreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 0.0);
SetEntityRenderColor(attacker, 255, 0, 170, 174);
}

UnFreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 1.0);
SetEntityRenderColor(attacker, 255, 255, 255, 255);
}

public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype){
if(victim <= 0 && victim > MaxClients){ return Plugin_Continue; }
if(attacker <= 0 || attacker > MaxClients){ return Plugin_Continue; }
if(damage > 66.0){
new String:wep[64];GetClientWeapon(attacker, wep, sizeof(wep));
if(StrEqual(wep, "weapon_knife", false)){
PrintToChat(attacker, "\x01[KNIFE]\x04 Backstab blocked!");
ClientCommand(attacker, "play *training/timer_bell.wav");
damage = 0.0;

return Plugin_Changed;
}
}
return Plugin_Continue;
}
EDIT:
that freezing stuff - use https://wiki.alliedmods.net/Timers_%28SourceMod_Scripting%29
and for the backstab thing - https://forums.alliedmods.net/showthread.php?t=260050 (GetClientButtons(attacker) & IN_ATTACK2)

Sn3amtz
04-10-2015, 05:17
Freeze not working

/groups/sourcemod/upload_tmp/textBcKlYh.sp(39) : warning 203: symbol is never used: "FreezePlayer"
/groups/sourcemod/upload_tmp/textBcKlYh.sp(39) : warning 203: symbol is never used: "UnFreezePlayer"

KissLick
04-10-2015, 07:24
See my previous post edit section - https://wiki.alliedmods.net/Timers_%28SourceMod_Scripting%29

hint:

#pragma semicolon 1
#include <sourcemod>
#include <sdkhooks>
#include <cstrike>
public OnClientPutInServer(client){
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}
public OnClientDisconnect(client){
SDKUnhook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}
FreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 0.0);
SetEntityRenderColor(attacker, 255, 0, 170, 174);
}
UnFreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 1.0);
SetEntityRenderColor(attacker, 255, 255, 255, 255);
}
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype){
if(victim <= 0 && victim > MaxClients){ return Plugin_Continue; }
if(attacker <= 0 || attacker > MaxClients){ return Plugin_Continue; }
if(damage > 66.0){
new String:wep[64];GetClientWeapon(attacker, wep, sizeof(wep));
if(StrEqual(wep, "weapon_knife", false)){
PrintToChat(attacker, "\x01[KNIFE]\x04 Backstab blocked!");
ClientCommand(attacker, "play *training/timer_bell.wav");
damage = 0.0;

FreezePlayer(attacker);
// INSERT TIMER HERE

return Plugin_Changed;
}
}
return Plugin_Continue;
}

// INSERT TIMER CALLBACK HERE (USE UnFreezePlayer(attacker) HERE)

Sn3amtz
04-10-2015, 07:41
Can u make a source to copy and paste or no?

#include <sourcemod>
#include <sdkhooks>
#include <cstrike>
public OnClientPutInServer(client){
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}
public OnClientDisconnect(client){
SDKUnhook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}
FreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 0.0);
SetEntityRenderColor(attacker, 255, 0, 170, 174);
}
UnFreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 1.0);
SetEntityRenderColor(attacker, 255, 255, 255, 255);
}
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype){
if(victim <= 0 && victim > MaxClients){ return Plugin_Continue; }
if(attacker <= 0 || attacker > MaxClients){ return Plugin_Continue; }
if(damage > 66.0){
new String:wep[64];GetClientWeapon(attacker, wep, sizeof(wep));
if(StrEqual(wep, "weapon_knife", false)){
PrintToChat(attacker, "\x01[KNIFE]\x04 Backstab blocked!");
ClientCommand(attacker, "play *training/timer_bell.wav");
damage = 0.0;

FreezePlayer(attacker);
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 0.0);
return Plugin_Changed;
}
}
return Plugin_Continue;
}
UnFreezePlayer(attacker);
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 1.0);
}


/groups/sourcemod/upload_tmp/text37kHt4.sp(10) : warning 219: local variable "attacker" shadows a variable at a preceding level
/groups/sourcemod/upload_tmp/text37kHt4.sp(15) : warning 219: local variable "attacker" shadows a variable at a preceding level
/groups/sourcemod/upload_tmp/text37kHt4.sp(20) : warning 219: local variable "attacker" shadows a variable at a preceding level
/groups/sourcemod/upload_tmp/text37kHt4.sp(37) : warning 219: local variable "attacker" shadows a variable at a preceding level
/groups/sourcemod/upload_tmp/text37kHt4.sp(37) : error 021: symbol already defined: "UnFreezePlayer"
/groups/sourcemod/upload_tmp/text37kHt4.sp(37) : error 010: invalid function or declaration
/groups/sourcemod/upload_tmp/text37kHt4.sp(39) : warning 203: symbol is never used: "UnFreezePlayer"
/groups/sourcemod/upload_tmp/text37kHt4.sp(38) : warning 203: symbol is never used: "__unknown__"
/groups/sourcemod/upload_tmp/text37kHt4.sp(38) : warning 203: symbol is never used: "attacker"

KissLick
04-10-2015, 08:24
Can u make a source to copy and paste or no?
Well I asumed that you don't want a copy+paste code, because you asked in scripting section... But if you ask so nicely :-)

(not tested)
#pragma semicolon 1
#include <sourcemod>
#include <sdkhooks>
#include <cstrike>

new bool:g_bFrozen[MAXPLAYERS + 1];

public OnPluginStart()
{
HookEvent("player_death", Event_PlayerDeath);
HookEvent("round_start", Event_RoundStart);
}

public OnClientPutInServer(client)
{
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}

public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));

if (client > 0 && client <= MaxClients && g_bFrozen[client]) {
g_bFrozen[client] = false;
}
}

public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
for (new i = 1; i <= MaxClients; i++) {
g_bFrozen[i] = false;
}
}

public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
if (victim < 1 || victim > MaxClients || attacker < 1 || attacker > MaxClients || g_bFrozen[attacker])
return Plugin_Continue;

if (damage > 66.0) {
new String:wep[64];GetClientWeapon(attacker, wep, sizeof(wep));

if (StrEqual(wep, "weapon_knife", false)) {
PrintToChat(attacker, "\x01[KNIFE]\x04 Backstab blocked!");
ClientCommand(attacker, "play *training/timer_bell.wav");

FreezePlayer(attacker);
CreateTimer(2.3, Timer_UnFreezePlayer, attacker);

return Plugin_Handled;
}
}
return Plugin_Continue;
}

public Action:Timer_UnFreezePlayer(Handle:timer, any:attacker)
{
UnFreezePlayer(attacker);
}

FreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 0.0);
SetEntityRenderColor(attacker, 255, 0, 170, 174);
g_bFrozen[attacker] = true;
}

UnFreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 1.0);
SetEntityRenderColor(attacker, 255, 255, 255, 255);
g_bFrozen[attacker] = false;
}


P.S.: next time, go here https://forums.alliedmods.net/forumdisplay.php?f=60

WildCard65
04-10-2015, 08:32
Well I asumed that you don't want a copy+paste code, because you asked in scripting section... But if you ask so nicely :-)

(not tested)
#pragma semicolon 1
#include <sourcemod>
#include <sdkhooks>
#include <cstrike>

new bool:g_bFrozen[MAXPLAYERS + 1];

public OnPluginStart()
{
HookEvent("player_death", Event_PlayerDeath);
HookEvent("round_start", Event_RoundStart);
}

public OnClientPutInServer(client)
{
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}

public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));

if (client > 0 && client <= MaxClients && g_bFrozen[client]) {
g_bFrozen[client] = false;
}
}

public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
for (new i = 1; i <= MaxClients; i++) {
g_bFrozen[i] = false;
}
}

public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
if (victim < 1 || victim > MaxClients || attacker < 1 || attacker > MaxClients || g_bFrozen[attacker])
return Plugin_Continue;

if (damage > 66.0) {
new String:wep[64];GetClientWeapon(attacker, wep, sizeof(wep));

if (StrEqual(wep, "weapon_knife", false)) {
PrintToChat(attacker, "\x01[KNIFE]\x04 Backstab blocked!");
ClientCommand(attacker, "play *training/timer_bell.wav");

FreezePlayer(attacker);
CreateTimer(2.3, Timer_UnFreezePlayer, attacker);

return Plugin_Handled;
}
}
return Plugin_Continue;
}

public Action:Timer_UnFreezePlayer(Handle:timer, any:attacker)
{
UnFreezePlayer(attacker);
}

FreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 0.0);
SetEntityRenderColor(attacker, 255, 0, 170, 174);
g_bFrozen[attacker] = true;
}

UnFreezePlayer(attacker)
{
SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 1.0);
SetEntityRenderColor(attacker, 255, 255, 255, 255);
g_bFrozen[attacker] = false;
}


P.S.: next time, go here https://forums.alliedmods.net/forumdisplay.php?f=60

Never pass a client index to a timer, pass the client's userid/client serial to the timer instead.

KissLick
04-10-2015, 08:43
Never pass a client index to a timer, pass the client's userid/client serial to the timer instead.
Yep, good point.

Sn3amtz
04-10-2015, 09:46
Thanks .. But how to change freeze time?

SetEntPropFloat(attacker, Prop_Data, "m_flLaggedMovementValue", 5.0); // I have Speed

KissLick
04-10-2015, 10:57
CreateTimer(2.3, Timer_UnFreezePlayer, attacker);