AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   subtracting time code (https://forums.alliedmods.net/showthread.php?t=187658)

yamin 06-16-2012 08:00

subtracting time code
 
this code doesn't works
PHP Code:

    formatex(g_query,511,"UPDATE played_time SET playedtime=playedtime-350 WHERE name='%s'",name)
    
SQL_ThreadQuery(sql,"query",g_query


hornet 06-17-2012 04:12

Re: subtracting time code
 
I'm at no advanced level of PHP, but I believe an entry must already exist in order to use UPDATE. Are you getting an error?

Show your full code.

yamin 06-17-2012 05:09

Re: subtracting time code
 
i am not getting errors just some warnings
PHP Code:

public client_death(killer,victim){
    if(
victim!=isolo)
        return
    
    new 
name[32]
    
get_user_name(victim,name,31)
    
    
formatex(g_query,511,"UPDATE played_time SET playedtime=playedtime-350 WHERE name='%s'",name)
    
SQL_ThreadQuery(sql,"query",g_query)
    
    
get_user_name(killer,name,31)
    
    
formatex(g_query,511,"UPDATE played_time SET playedtime=playedtime+100 WHERE name='%s'",name)
    
SQL_ThreadQuery(sql,"query",g_query)



YamiKaitou 06-17-2012 05:13

Re: subtracting time code
 
What are the warnings you are getting?

yamin 06-17-2012 05:17

Re: subtracting time code
 
/tmp/textseJfqW.sma(39) : warning 201: redefinition of constant/macro (symbol "SILVER")
/tmp/textseJfqW.sma(41) : warning 201: redefinition of constant/macro (symbol "ADMIN")
/tmp/textseJfqW.sma(59) : warning 217: loose indentation
/tmp/textseJfqW.sma(105) : warning 217: loose indentation
/tmp/textseJfqW.sma(108) : warning 217: loose indentation
/tmp/textseJfqW.sma(113) : warning 217: loose indentation
/tmp/textseJfqW.sma(128) : warning 209: function "eCurWeapon" should return a value
/tmp/textseJfqW.sma(134) : warning 217: loose indentation
/tmp/textseJfqW.sma(135) : warning 217: loose indentation
/tmp/textseJfqW.sma(137) : warning 217: loose indentation
/tmp/textseJfqW.sma(163) : warning 217: loose indentation
/tmp/textseJfqW.sma(173) : warning 217: loose indentation
/tmp/textseJfqW.sma(373) : warning 203: symbol is never used: "colorChat"
/tmp/textseJfqW.sma(373) : warning 203: symbol is never used: "findAnyPlayer"
/tmp/textseJfqW.sma(373) : warning 203: symbol is never used: "g_addCvar"
/tmp/textseJfqW.sma(373) : warning 203: symbol is never used: "messageSayText"
/tmp/textseJfqW.sma(373) : warning 203: symbol is never used: "messageTeamInfo"

yamin 06-17-2012 05:22

Re: subtracting time code
 
there is no warning in this code

YamiKaitou 06-17-2012 05:23

Re: subtracting time code
 
Those warnings do not apply to the code snippet you supplied


Now, back to your original question. Define "doesn't work". How do you know it is not working? What kind of debugging have you done? Are you sure it is even executing? Is the SQL server accepting your query and executing it without any errors?

Waleed 06-17-2012 05:56

Re: subtracting time code
 
For loose indentation you can use Indenter,Click on Tools->Indenter
This should solve your 99% indentation warning.
You have put these variables,But you are not using them,Put "//" before them to disable,If no warnings are given,Then you can delete those variables as you are not using them.


/tmp/textseJfqW.sma(373) : warning 203: symbol is never used: "colorChat"
/tmp/textseJfqW.sma(373) : warning 203: symbol is never used: "findAnyPlayer"
/tmp/textseJfqW.sma(373) : warning 203: symbol is never used: "g_addCvar"
/tmp/textseJfqW.sma(373) : warning 203: symbol is never used: "messageSayText"
/tmp/textseJfqW.sma(373) : warning 203: symbol is never used: "messageTeamInfo"

yamin 06-17-2012 12:10

Re: subtracting time code
 
how will i know if the plugin works or not?

fysiks 06-17-2012 12:27

Re: subtracting time code
 
Quote:

Originally Posted by yamin (Post 1730537)
how will i know if the plugin works or not?

lol, I think you are in trouble if you have to ask that. The plugin works if it does what it is supposed to do. Therefore, if it does not do what it is supposed to do then it doesn't work . . .


All times are GMT -4. The time now is 06:12.

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