Raised This Month: $ Target: $400
 0% 

symbol is assigned a value that is never used: "time"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kempus
Member
Join Date: Jan 2016
Old 09-19-2016 , 11:32   symbol is assigned a value that is never used: "time"
Reply With Quote #1

I'm trying to do something like that, but i get error

Code:
//SourceMod Batch Compiler
// by the SourceMod Dev Team


//// grupa.sp
//
// E:\codek\sm 1.8\addons\sourcemod\scripting\grupa.sp(16) : warning 204: symbol
 is assigned a value that is never used: "time"
// E:\codek\sm 1.8\addons\sourcemod\scripting\grupa.sp(21) : error 017: undefine
d symbol "time"
//
// 1 Error.
//
// Compilation Time: 0,19 sec
// ----------------------------------------

Press enter to exit ...
What's wrong? ;_;
Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

public Plugin:myinfo =
{
    name = "Join Group",
    author = "xxx",
    description = "xxx",
    version = "1.0",
    url = "xxx"
}

public void OnClientPostAdminCheck(int client)
{
    time = RoundFloat(GetClientTime(client));
}

public Action Timer_Time(int client)
{
    if(!time >= 120)
    {
        CreateTimer(10.0, Timer_Grupa, client);
    }
}

public Action Timer_Grupa(Handle timer, any client)
{
    if(IsClientInGame(client) && !CheckCommandAccess(client, "sm_reklama", ADMFLAG_RESERVATION))
    {
        FakeClientCommandEx(client, "say !grupa"); // say !grupa
    }
}

Last edited by Kempus; 09-19-2016 at 11:32.
Kempus is offline
Chrissy
Member
Join Date: May 2013
Old 09-19-2016 , 12:09   Re: symbol is assigned a value that is never used: "time"
Reply With Quote #2

First off, 'Action Timer_Time' is not a valid callback, since you didn't create a timer defining this.

Second, 'time' is in the local scope within 'OnClientPostAdminCheck' you must make it global. (Meaning put it outside all the functions and assign it values.)

Third, 'time' would be below 1.0 all the time and that statment would never be true. Get the client time in the command/timer thing.

Last edited by Chrissy; 09-19-2016 at 12:10.
Chrissy is offline
OSWO
Senior Member
Join Date: Jul 2015
Location: United Kingdom, London
Old 09-19-2016 , 14:44   Re: symbol is assigned a value that is never used: "time"
Reply With Quote #3

You havn't declared the variable time anywhere?

Quote:
Originally Posted by Chrissy View Post
First off, 'Action Timer_Time' is not a valid callback, since you didn't create a timer defining this.
????????????????????????????????????????????? ??????
PHP Code:
CreateTimer(10.0Timer_Grupaclient); 

Here, I'll redo it for you.

PHP Code:
#include <sourcemod>

Handle gH_Timer[MAXPLAYERS 1];
int gI_Time[MAXPLAYERS 1];

public 
void OnClientPostAdminCheck(int I_Client) {
    
gH_Timer[I_Client] = CreateTimer(1.0Timer_ChecksI_ClientTIMER_REPEAT);
}

public 
void OnClientDisconnect(int I_Client) {
    
misc_TryClearTimer(I_Client);
}

public 
void misc_TryClearTimer(int I_Client) {
    
gI_Time[I_Client] = 0;

    if (
gH_Timer[I_Client] != INVALID_HANDLE) {
        
KillTimer(gH_Timer[I_Client]);
        
gH_Timer[I_Client] = INVALID_HANDLE;
    }
}

public 
Action Timer_Checks(Handle timerint I_Client) {
    
gI_Time[I_Client]++;

    if (
gI_Time[I_Client] >= 128) {
        
//Do your commands here
        
misc_TryClearTimer(I_Client);
    }

__________________
SourceTimer | WeaponSkins++ | BasePlugins++ https://github.com/OSCAR-WOS

Last edited by OSWO; 09-19-2016 at 14:51.
OSWO 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 23:49.


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