AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Restarted scripting,some problems :S (https://forums.alliedmods.net/showthread.php?t=24673)

broertje 02-28-2006 14:57

Restarted scripting,some problems :S
 
Hi,i just restarted scripting and i tried to make a script without i relearned something.

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "Announce + Client info" #define VERSION "1.0" #define AUTHOR "Broertje" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     } public client_putinserver(id) {          new name[33]     get_user_name(id,name,32)     if(is_user_admin(id))     {         set_hudmessage(255, 0, 0, -1.0, 0.0, 0, 6.0, 12.0)                   show_hudmessage(0, "%s has joined the n00bs",name)                 return PLUGIN_HANDLED     }         set_hudmessage(85, 255, 0, 0.00, -1.0, 0, 6.0, 12.0)     show_hudmessage(0,"Welcome %s. Have fun here!",name)             return PLUGIN_HANDLED } public client_disconnect(id) {          new name[33]     get_user_name(id,name,32)          if(is_user_admin(id))      {         set_hudmessage(255, 0, 0, -1.0, 0.0, 0, 6.0, 12.0)                   show_hudmessage(0, "%s has left the house",name)                     return PLUGIN_HANDLED     }         set_hudmessage(85, 255, 0, 0.00, -1.0, 0, 6.0, 12.0)     show_hudmessage(0,"%s has left. Goodbye!",name)             return PLUGIN_HANDLED } public advertising new ping[33] new curtime[33] get_user_ping(id,ping,32) get_user_time(id,curtime,32) if(is_user_alive(id)) if(is_user_connected(0)) { client_print(id, print_chat, "Your ping is: %s , And the time: %s",ping,curtime) {

broertje 02-28-2006 14:58

I have many errors,show me what i did wrong so i can learn it

c0rdawg 02-28-2006 15:03

public advertising
needs a { on the next line

the { after
client_print(id, print_chat, "Your ping is: %s , And the time: %s",ping,curtime)

needs to be a }
and you need to close that function with a }

broertje 02-28-2006 15:31

Error: Start of function body without function header on line 50
is the { below advertising

c0rdawg 02-28-2006 15:45

Code:
public advertising(id) { new ping[33] new curtime[33] get_user_ping(id,ping,32) get_user_time(id,curtime,32) if(is_user_alive(id)) if(is_user_connected(id)) { client_print(id, print_chat, "Your ping is: %s , And the time: %s",ping,curtime) } }

should be more like that...

and get_user_time gives you how long the user has been playing in the server...

also this never is called, you probably want a set_task or something

broertje 02-28-2006 15:54

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "Announce + Client info" #define VERSION "1.0" #define AUTHOR "Broertje" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     } public client_putinserver(id) {          new name[33]     get_user_name(id,name,32)     if(is_user_admin(id))     {         set_hudmessage(255, 0, 0, -1.0, 0.0, 0, 6.0, 12.0)                   show_hudmessage(0, "%s has joined the n00bs",name)                 return PLUGIN_HANDLED     }         set_hudmessage(85, 255, 0, 0.00, -1.0, 0, 6.0, 12.0)     show_hudmessage(0,"Welcome %s. Have fun here!",name)             return PLUGIN_HANDLED } public client_disconnect(id) {          new name[33]     get_user_name(id,name,32)          if(is_user_admin(id))      {         set_hudmessage(255, 0, 0, -1.0, 0.0, 0, 6.0, 12.0)                   show_hudmessage(0, "%s has left the house",name)                     return PLUGIN_HANDLED     }         set_hudmessage(85, 255, 0, 0.00, -1.0, 0, 6.0, 12.0)     show_hudmessage(0,"%s has left. Goodbye!",name)             return PLUGIN_HANDLED } public advertising() { new ping[33] new curtime[33] get_user_ping(id,ping,32) get_user_time(id,curtime,32) if(is_user_alive(id)) if(is_user_connected(0)) { client_print(id, print_chat, "Your ping is: %s , You've been playing: %s on server.",ping,curtime) } }

Still some problems

c0rdawg 02-28-2006 15:58

Code:
public advertising(id) { new ping[33] new curtime[33] get_user_ping(id,ping,32) get_user_time(id,curtime,32) if(is_user_alive(id)) if(is_user_connected(id)) { client_print(id, print_chat, "Your ping is: %s , And the time: %s",ping,curtime) } }

It would take me too long to look through all that, so tell me what errors you're getting

broertje 02-28-2006 16:09

Welcome to the AMX Mod X 1.60-300 Compiler.
Copyright (c) 1997-2005 ITB CompuPhase, AMX Mod X Team

Warning: Loose indentation on line 17
Warning: Loose indentation on line 21
Warning: Loose indentation on line 23
Warning: Loose indentation on line 34
Warning: Loose indentation on line 35
Warning: Loose indentation on line 38
Warning: Loose indentation on line 40
Warning: Loose indentation on line 43
Error: Undefined symbol "id" on line 53
Warning: Expression has no effect on line 53
Warning: Expression has no effect on line 53
Error: Expected token: ";", but found ")" on line 53
Error: Invalid expression, assumed zero on line 53
Error: Too many error messages on one line on line 53

Compilation aborted.
4 Errors.

c0rdawg 02-28-2006 16:16

This compiles

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "Announce + Client info" #define VERSION "1.0" #define AUTHOR "Broertje" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     } public client_putinserver(id)     {     new name[33]     get_user_name(id,name,32)     if(is_user_admin(id))         {         set_hudmessage(255, 0, 0, -1.0, 0.0, 0, 6.0, 12.0)         show_hudmessage(0, "%s has joined the n00bs",name)                 return PLUGIN_HANDLED     }         set_hudmessage(85, 255, 0, 0.00, -1.0, 0, 6.0, 12.0)     show_hudmessage(0,"Welcome %s. Have fun here!",name)         return PLUGIN_HANDLED } public client_disconnect(id)     {     new name[33]     get_user_name(id,name,32)     if(is_user_admin(id))         {         set_hudmessage(255, 0, 0, -1.0, 0.0, 0, 6.0, 12.0)         show_hudmessage(0, "%s has left the house",name)                 return PLUGIN_HANDLED     }         set_hudmessage(85, 255, 0, 0.00, -1.0, 0, 6.0, 12.0)     show_hudmessage(0,"%s has left. Goodbye!",name)         return PLUGIN_HANDLED } public advertising(id)     {     new ping, loss, curtime     get_user_ping(id,ping, loss)     get_user_time(id,curtime)     if(is_user_alive(id))         if(is_user_connected(id))         {         client_print(id, print_chat, "Your ping is: %s , You've been playing: %s on server.",ping,curtime)     } }

teame06 02-28-2006 17:00

Code:
public client_putinserver(id)     {     new name[33]     get_user_name(id,name,32)     if(is_user_admin(id))         {         set_hudmessage(255, 0, 0, -1.0, 0.0, 0, 6.0, 12.0)         show_hudmessage(0, "%s has joined the n00bs",name)                 return PLUGIN_HANDLED     }         set_hudmessage(85, 255, 0, 0.00, -1.0, 0, 6.0, 12.0)     show_hudmessage(0,"Welcome %s. Have fun here!",name)         return PLUGIN_HANDLED }

To show something on a client_putinserver is still way to early .. You have to delay it about 10 secs


All times are GMT -4. The time now is 20:23.

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