AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Simple Error :( (https://forums.alliedmods.net/showthread.php?t=62527)

emoD 10-29-2007 10:22

Simple Error :(
 
Hello, I'm New At AMXX Scripting But I Know C++ Syntax.
I've Tryed To Creat Plugin But There Is Alot Of Errors And I Don't Know What To Do.

Code:

/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "DainiusD"
#define MATCH_P 10
new Players[32], Act, I, Player
public plugin_init() {
 register_plugin(PLUGIN, VERSION, AUTHOR)
 
 get_players(Players, Act)
 for (I=0; I<Act; I++)
    Player = Players[I]
    if (Player < MATCH_P) {
      set_hudmessage(0, 255, 0, -1.0, -1.0)
      show_hudmessage(id, "Waiting For Other Players")     
    }
    else if (Player > MATCH_P) {
      set_hudmessage(0, 255, 0, -1.0, -1.0)
      show_hudmessage(id, "Too Many Players On Server")
    }
    else if (Player == Match_P) {
      set_hudmessage(0, 255, 0, -1.0, -1.0)
      show_hudmessage(id, "Players Have Joined Server, Match Starting...")
 }
  return PLUGIN_HANDLED
}

Code:

/home/groups/amxmodx/tmp3/textlReC14.sma(20) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/textlReC14.sma(22) : error 017: undefined symbol "id"
/home/groups/amxmodx/tmp3/textlReC14.sma(22) : warning 215: expression has no effect
/home/groups/amxmodx/tmp3/textlReC14.sma(22) : error 001: expected token: ";", but found ")"
/home/groups/amxmodx/tmp3/textlReC14.sma(22) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/textlReC14.sma(22) : fatal error 107: too many error messages on one line

Compilation aborted.
4 Errors.

Srry For My English.
Could Someone Help Me? Thanks.

Alka 10-29-2007 10:28

Re: Simple Error :(
 
I realy don't get the usage of this plugin but nvm...

Code:

#include <amxmodx>
 
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "DainiusD"
 
#define MATCH_P 10
 
new Players[32], Act;
 
public plugin_init() {
 
 register_plugin(PLUGIN, VERSION, AUTHOR)
 
 get_players(Players, Act);
 
 if (Act < MATCH_P) {
  set_hudmessage(0, 255, 0, -1.0, -1.0)
  show_hudmessage(0, "Waiting For Other Players")     
 }
 
 else if (Act > MATCH_P) {
  set_hudmessage(0, 255, 0, -1.0, -1.0)
  show_hudmessage(0, "Too Many Players On Server")
 }
 
 else if (Act == MATCH_P) {
  set_hudmessage(0, 255, 0, -1.0, -1.0)
  show_hudmessage(0, "Players Have Joined Server, Match Starting...")
 }
}

I think you must do a check whenever a player is enter on server, and after that display the messages :s

Note: plugin_init() - is called once, when plugins are initiallyzed(server open / mapchange)

emoD 10-29-2007 10:32

Re: Simple Error :(
 
how to do check?

i need to show message all the time when Players < MATCH_P :S
but dunno how :(

Alka 10-29-2007 10:38

Re: Simple Error :(
 
Here :

Code:

#include <amxmodx>
 
#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "emoD"
 
#define MIN_PLAYERS 10
 
public plugin_init() {
 
 register_plugin(PLUGIN, VERSION, AUTHOR);
}
 
public client_putinserver(id)
{
 static Players[32], Num;
 get_players(Players, Num, "ch");
 
 if(Num < MIN_PLAYERS)
 {
  set_hudmessage(0, 255, 0, -1.0, -1.0, 0, 6.0, 5.0, 0.1, 0.1, -1);
  show_hudmessage(id, "! Waiting for other players...");
 }
 else if(Num > MIN_PLAYERS)
 {
  set_hudmessage(0, 255, 0, -1.0, -1.0, 0, 6.0, 5.0, 0.1, 0.1, -1);
  show_hudmessage(id, "! Too many players on server...");
 }
 else if(Num == MIN_PLAYERS)
 {
  set_hudmessage(0, 255, 0, -1.0, -1.0, 0, 6.0, 5.0, 0.1, 0.1, -1);
  show_hudmessage(id, "! Enough players has joined.Match started...");
 }
}


Arkshine 10-29-2007 10:55

Re: Simple Error :(
 
Probably a little better. I don't like using set_task().

Code:
    #include <amxmodx>           #define MIN_PLAYERS 10     #define MAX_PLAYERS 32         #define LOOP_TIME 2.0                 public plugin_init()     {         register_plugin( "Waiting players", "1.0", "Amxx Community" );                 set_task( LOOP_TIME, "DisplayHUD", 0, _, _, "b" );     }             public DisplayHUD()     {         switch( get_playersnum() )         {             case 1 .. MIN_PLAYERS - 1 :             {                 set_hudmessage( 0, 255, 0, 0.1, 0.5, 0, 6.0, 5.0, 0.1, 0.1, -1 );                 show_hudmessage( 0, "! Waiting for other players..." );             }             case MIN_PLAYERS :             {                 set_hudmessage(0, 255, 0, 0.1, 0.5, 0, 6.0, 5.0, 0.1, 0.1, -1 );                 show_hudmessage( 0, "! Enough players has joined.Match started...");             }             case MIN_PLAYERS + 1 .. MAX_PLAYERS :             {                 set_hudmessage(0, 255, 0, 0.1, 0.5, 0, 6.0, 5.0, 0.1, 0.1, -1 );                 show_hudmessage( 0, "! Too many players on server...");             }             default : return;         }     }

emoD 10-29-2007 11:06

Re: Simple Error :(
 
Many Thanks To You Guys :)
Finaly Plugin Is Working

Alka 10-29-2007 11:09

Re: Simple Error :(
 
Quote:

Originally Posted by arkshine (Post 547384)
Probably a little better. I don't like using set_task().

:lol: , but you use it...

Arkshine 10-29-2007 11:15

Re: Simple Error :(
 
Yeah. Because I don't want to think too much just for that. :mrgreen:


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

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