Raised This Month: $ Target: $400
 0% 

Why the hell won't this work?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kotinha
Senior Member
Join Date: Jun 2009
Location: Alentejo, Portugal :)
Old 03-11-2011 , 19:37   Why the hell won't this work?
Reply With Quote #1

Okay, so, I'm getting frustrated with this because the plugin does nothing, but it is active -.-
Call me stupid, retarded, whatever you want but tell me how the hell will this work!
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

new PLUGIN[]="WAR MANAGER"
new AUTHOR[]="THONY"
new VERSION[]="1.00"

new playersready=0

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("TeamScore""team_score""a")
    
register_event("say .startwar""war_start""a")
    
register_event("say .ready""ready""a")
}
public 
war_start()
{
    
client_print(0,print_chat,"[WARMNG] War is starting..."
    if(
get_playersnum(0)!=10) {
        
server_cmd("say [WARMNG] Waiting for all players..."
    }
}

public 
ready() {
    
playersready++;
    if(
playersready==10)
    {
        
set_task(0.1"starting")
    }
}
public 
starting() {
    
server_cmd("say [WARMNG] All players are now ready, game is starting!..."
    
server_cmd("exec warcfg.cfg")
    new 
r
    
for(r=3;r<=1;r--)
    {
        
set_task(1"restart"r)
    }
}
public 
restart(id)
{
    
server_cmd("sv_restart 1")
    
server_cmd("say [WARMNG] Starting in %i"id)

__________________
"If God exists, I hope he has a good excuse." - Woody Allen
kotinha is offline
Old 03-11-2011, 21:02
infek
This message has been deleted by infek.
fmfs10
Senior Member
Join Date: Mar 2009
Location: Brasil
Old 03-11-2011 , 22:00   Re: Why the hell won't this work?
Reply With Quote #2

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

// Use constat because there will be no change
new const PLUGIN[] = "WAR MANAGER"
new const AUTHOR[] = "THONY"
new const VERSION[] = "1.00"

new playersready
new Time

public plugin_init() {
    
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("TeamScore""team_score""a")
    
register_event("say .startwar""war_start""a")
    
register_event("say .ready""ready""a")
    
}
public 
war_start()
{
    
client_print(0,print_chat,"[WARMNG] War is starting...")
    
// 0 is unnecessary as it is default value
    
if(get_playersnum() != 10) {
        
server_cmd("say [WARMNG] Waiting for all players...")
    }
}

public 
ready() {
    
playersready++;
    if(
playersready == 10) {
        
// The task is unnecesary...
        
starting()
    }
}
public 
starting() {
    
server_cmd("say [WARMNG] All players are now ready, game is starting!...")
    
server_cmd("exec warcfg.cfg")
    
    
// <= will just make the loop don't work
    
for(new 3;>= 1;r--)
    {
        
// r isn't a id... so removed it :)
        // you don't need a id anyway as it is for all players
        
set_task(1.0"restart")
    }
}
public 
restart()
{
    
// Set Time to the number that you want
    // Time = NUMBER
    
server_cmd("sv_restart 1")
    
server_cmd("say [WARMNG] Starting in %i"Time)

This should work... But there should be a LOT of thinks more for your plugin work correctly, like checking if someone disconnected
Oh, and spacing is good you know?

Last edited by fmfs10; 03-11-2011 at 22:05. Reason: removed a unnecessary set_task
fmfs10 is offline
kotinha
Senior Member
Join Date: Jun 2009
Location: Alentejo, Portugal :)
Old 03-11-2011 , 22:13   Re: Why the hell won't this work?
Reply With Quote #3

The plugin is not finished yet...
I've tried to say .startwar or .ready and it still does nothing... Shouldn't this say "[WARMNG] War is starting..."? What's wrong with this?

And thanks for the tips
__________________
"If God exists, I hope he has a good excuse." - Woody Allen
kotinha is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-11-2011 , 22:50   Re: Why the hell won't this work?
Reply With Quote #4

Chat commands are not "events". You need to register them as client commands:

PHP Code:
    register_event("say .startwar""war_start""a")
    
register_event("say .ready""ready""a"


PHP Code:
    register_clcmd("say .startwar""war_start")
    
register_clcmd("say .ready""ready"
__________________
fysiks is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 03-11-2011 , 22:50   Re: Why the hell won't this work?
Reply With Quote #5

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

new const PLUGIN[] = "WAR MANAGER"
new const AUTHOR[] = "THONY"
new const VERSION[] = "1.00"

new playersready
new Time

public plugin_init() {
    
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("TeamScore""team_score""a")
    
    
//Register these say commands as clcmds instead of events.
    
register_clcmd("say .startwar""war_start" //Dont need the flags
    
register_clcmd("say .ready""ready" )
    
}
public 
war_start()
{
    
//Check if the players num is 10 before saying that the war is starting.
    
if(get_playersnum() != 10) {
        
server_cmd("say [WARMNG] Waiting for all players...")
    }
    
    else 
client_print(0,print_chat,"[WARMNG] War is starting...")
    
}

public 
ready() {
    
playersready++;
    if(
playersready == 10) {.
        
starting()
    }
}
public 
starting() {
    
server_cmd("say [WARMNG] All players are now ready, game is starting!...")
    
server_cmd("exec warcfg.cfg")
    
    
//Didn'tt need foor loop. Setting the task thrice, when you can do something much simpler.
    
    //Set the time to three here.
    
Time 3;
    
set_task1.0"restart"___"a"); //The second to last parameter signals that it's a repeated command, the last paramater is how many times to repeat
}
public 
restart()
{
    
// Set Time to the number that you want
    
server_cmd("sv_restart 1")
    
server_cmd("say [WARMNG] Starting in %i"Time)
    
    
Time--; //Decrease time for countdown

Try that.


EDIT: Damnit fysiks..

EDIT EDIT: Oops, didn't notice that you registered an even that doesn't have a function. (Teamscore). You coudl take it out if you want.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please

Last edited by nikhilgupta345; 03-11-2011 at 22:56.
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
schmurgel1983
Veteran Member
Join Date: Aug 2006
Location: Germany
Old 03-12-2011 , 02:12   Re: Why the hell won't this work?
Reply With Quote #6

in public starting() why restart? is this not sv_restartround?
__________________

Working on:
nothing
schmurgel1983 is offline
infek
Senior Member
Join Date: May 2009
Location: Behind you
Old 03-12-2011 , 02:44   Re: Why the hell won't this work?
Reply With Quote #7

Its a task that is set for 3 seconds after those 3 seconds are done it goes to public restart( )
__________________
"Domo Arigato, Mr. Roboto!"
PM me if you want to know a secret
infek is offline
kotinha
Senior Member
Join Date: Jun 2009
Location: Alentejo, Portugal :)
Old 03-12-2011 , 06:26   Re: Why the hell won't this work?
Reply With Quote #8

Quote:
Originally Posted by nikhilgupta345 View Post
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

new const PLUGIN[] = "WAR MANAGER"
new const AUTHOR[] = "THONY"
new const VERSION[] = "1.00"

new playersready
new Time

public plugin_init() {
    
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("TeamScore""team_score""a")
    
    
//Register these say commands as clcmds instead of events.
    
register_clcmd("say .startwar""war_start" //Dont need the flags
    
register_clcmd("say .ready""ready" )
    
}
public 
war_start()
{
    
//Check if the players num is 10 before saying that the war is starting.
    
if(get_playersnum() != 10) {
        
server_cmd("say [WARMNG] Waiting for all players...")
    }
    
    else 
client_print(0,print_chat,"[WARMNG] War is starting...")
    
}

public 
ready() {
    
playersready++;
    if(
playersready == 10) {.
        
starting()
    }
}
public 
starting() {
    
server_cmd("say [WARMNG] All players are now ready, game is starting!...")
    
server_cmd("exec warcfg.cfg")
    
    
//Didn'tt need foor loop. Setting the task thrice, when you can do something much simpler.
    
    //Set the time to three here.
    
Time 3;
    
set_task1.0"restart"___"a"); //The second to last parameter signals that it's a repeated command, the last paramater is how many times to repeat
}
public 
restart()
{
    
// Set Time to the number that you want
    
server_cmd("sv_restart 1")
    
server_cmd("say [WARMNG] Starting in %i"Time)
    
    
Time--; //Decrease time for countdown

Try that.


EDIT: Damnit fysiks..

EDIT EDIT: Oops, didn't notice that you registered an even that doesn't have a function. (Teamscore). You coudl take it out if you want.
When compiling this it says:
Code:
/tmp/texttBSbc3.sma(36) : error 029: invalid expression, assumed zero
/tmp/texttBSbc3.sma(37) : warning 217: loose indentation

1 Error.
Could not locate output file /home/groups/amxmodx/public_html/websc3/texttBSbc3.amx (compile failed).
???


EDIT: I tried to change only the client commands part and it didn't work neither :/ It didn't give any errors when compiling but in-game the commands .startwar and .ready don't work (like usually).
__________________
"If God exists, I hope he has a good excuse." - Woody Allen

Last edited by kotinha; 03-12-2011 at 06:48.
kotinha is offline
tRipLe.
Senior Member
Join Date: Dec 2009
Location: Estonia, Pärnu
Old 03-12-2011 , 06:52   Re: Why the hell won't this work?
Reply With Quote #9

PHP Code:
public ready() {
    
playersready++;
    if(
playersready == 10) {.
        
starting()
    }

Why is that dot after { ?
__________________
τsэ - servers.ee:9987
tRipLe. is offline
Send a message via MSN to tRipLe. Send a message via Skype™ to tRipLe.
kotinha
Senior Member
Join Date: Jun 2009
Location: Alentejo, Portugal :)
Old 03-12-2011 , 06:59   Re: Why the hell won't this work?
Reply With Quote #10

It's there because he wants to mess with me, I think...
It is so small in AMXX Studio that I didn't see it

Thanks for the reply

EDIT: F*CKKKKK it still does nothing !! Whyy??!!
__________________
"If God exists, I hope he has a good excuse." - Woody Allen

Last edited by kotinha; 03-12-2011 at 08:26.
kotinha is offline
Reply


Thread Tools
Display Modes

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 14:35.


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