Raised This Month: $ Target: $400
 0% 

What did i do wrong? Help me with this script


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 01-25-2005 , 11:47   What did i do wrong? Help me with this script
Reply With Quote #1

I made (tryed to make) my first script ever today. And of course it dont work . I made a command that allows me to change other peoples name, but it errors when i try to compile it. Can somebody fix it or tell me what i did wrong? I just used a help file, which showed a change hp command. And i tryed to change it to change name instead... Here it is:

Code:
#include <amxmodx> #include <amxmisc> new PLUGIN[]="Change Name" new AUTHOR[]="XunTric" new VERSION[]="1.0" public plugin_init() {     register_plugin(Change Name, 1.0, XunTric)     register_concmd("amx_name", "cmd_name", ADMIN_SLAY, " ") } public cmd_hp(id, level, cid) {     if (!cmd_acces(id, level, cid, 3))         return PLUGIN_HANDLED     new Arg1[24]     new Arf2[4]     read_argv(1, Arg1, 23)     read_argv(2, Arg2, 3)     new Name = str_to_num (Arg2)     if (arg[0] == '@')     {         new Team = 0         if (equali(arg[1], "CT))         {              Team = 2         } else if (equali(Arg1[1], "T)) {              Team = 1         }         new players[32}, num         get_players(players, num)         new i         for (i=0; 1<num; 1++)         {              if (!Team)              {                   set_user_name(players[i], Name)              } else {                   if (get_user_team(players[i]) == Team)                   {                        set_user_name(players[i], Name)                   }                   }          }         } else {                 new player = cmd_target(id, arg1, 1)         if (!player)         {              console_print (id, ""Sorry, player %s could not be found or targetted!", Arg1)              retrun PLUGIN_HANDLED             } else {              set_user_name(player, Name)         }           return PLUGIN_HANDLED     }
XunTric is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 01-25-2005 , 12:06  
Reply With Quote #2

I'm too lazy to compile this myself, but:
Code:
        if (equali(arg[1], "CT))
should be
Code:
        if (equali(arg[1], "CT"))



Code:
        } else if (equali(Arg1[1], "T)) {
should be
Code:
        } else if (equali(Arg1[1], "T")) {

Code:
console_print (id, ""Sorry, player %s could not be found or targetted!", Arg1)
should be
Code:
console_print (id, "Sorry, player %s could not be found or targetted!", Arg1)
__________________
hello, i am pm
PM is offline
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 01-25-2005 , 12:51  
Reply With Quote #3

Still dont work this is how it looks now:

Code:
#include <amxmodx> #include <amxmisc> new PLUGIN[]="Change Name" new AUTHOR[]="XunTric" new VERSION[]="1.0" public plugin_init() {     register_plugin(Change Name, 1.0, XunTric)     register_concmd("amx_name", "cmd_name", ADMIN_SLAY, " ") } public cmd_name(id, level, cid) {     if (!cmd_acces(id, level, cid, 3))         return PLUGIN_HANDLED     new Arg1[24]     new Arg2[4]     read_argv(1, Arg1, 23)     read_argv(2, Arg2, 3)     new Name = str_to_num (Arg2)     if (arg[0] == '@')     {         new Team = 0         if (equali(arg[1], "CT"))         {              Team = 2         } else if (equali(Arg1[1], "T")) {              Team = 1         }         new players[32}, num         get_players(players, num)         new i         for (i=0; 1<num; 1++)         {              if (!Team)              {                   set_user_name(players[i], Name)              } else {                   if (get_user_team(players[i]) == Team)                   {                        set_user_name(players[i], Name)                   }                  }         }        } else {                 new player = cmd_target(id, arg1, 1)         if (!player)         {              console_print (id, "Sorry, player %s could not be found or targetted!", Arg1)              retrun PLUGIN_HANDLED             } else {              set_user_name(player, Name)         }           return PLUGIN_HANDLED     }
XunTric is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 01-25-2005 , 14:13  
Reply With Quote #4

Code:
retrun PLUGIN_HANDLED

should be

Code:
return PLUGIN_HANDLED

Come on man u can find spelling errors
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 01-25-2005 , 15:00  
Reply With Quote #5

Still dont work! Maybe the whole script is completely wrong? And is the spaces very important? Isnt it 4 spaces betwen new commands/lines??
---EDIT---
I tested compiling it at the compiler link on amxmodx.org. There i got this message:
"Read the errors above. Your plugin failed to compile. Make sure it is has the correct #includes."
Do i have right includes?

posting again what i got now:
Code:
#include <amxmodx> #include <amxmisc> #include <fun> new PLUGIN[]="Change Name" new AUTHOR[]="XunTric" new VERSION[]="1.0" public plugin_init() {     register_plugin(Change Name, 1.0, XunTric)     register_concmd("amx_name", "cmd_name", ADMIN_SLAY, " ") } public cmd_name(id, level, cid) {     if (!cmd_acces(id, level, cid, 3))     return PLUGIN_HANDLED     new Arg1[24]     new Arg2[4]     read_argv(1, Arg1, 23)     read_argv(2, Arg2, 3)     new Name = str_to_num (Arg2)     if (arg[0] == '@')     {         new Team = 0         if (equali(arg[1], "CT"))         {             Team = 2         } else if (equali(Arg1[1], "T")) {             Team = 1         }         new players[32}, num         get_players(players, num)         new i         for (i=0; 1<num; 1++)         {             if (!Team)             {                 set_user_name(players[i], Name)             } else {                 if (get_user_team(players[i]) == Team)                  {                      set_user_name(players[i], Name)                 }                 }         }         } else {                 new player = cmd_target(id, arg1, 1)         if (!player)         {             console_print (id, "Sorry, player %s could not be found or targetted!", Arg1)             return PLUGIN_HANDLED             } else {             set_user_name(player, Name)         }           return PLUGIN_HANDLED     }
XunTric is offline
BlueRaja
Senior Member
Join Date: Nov 2004
Old 01-25-2005 , 16:56  
Reply With Quote #6

No, spacing doesn't matter..
As for the script: This, JGHG, is exactly why I created find.inc.
BlueRaja is offline
Send a message via AIM to BlueRaja Send a message via MSN to BlueRaja
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 01-25-2005 , 20:17  
Reply With Quote #7

Can we see the error? It tells you the exact line...
Peli is offline
Send a message via MSN to Peli
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 01-26-2005 , 08:01  
Reply With Quote #8

Ok ill post all errors. When i compile with the program in my scripting folder i get this message:


// AMXXSC compile.exe
// by the AMX Mod X Dev Team

//// amx_name.sma
// Internal error.

Press enter to exit...


When i try using the compiler link on amxmodx.org i get this message:


Welcome to the AMX Mod X 1.00-251 Compiler.
Copyright (c) 1997-2004 ITB CompuPhase, AMX Mod X Team

Read the errors above. Your plugin failed to compile. Make sure it is has the correct #includes. (There isnt any errors above.)

Go back

38460 plugin compiles to date.
This tool by: David "BAILOPAN" Anderson


Did this help? Can somebody check if the whole script is wrong? Because this is the first script i ever made. And do i have the right includes like the error message asks for??
XunTric is offline
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 01-27-2005 , 15:50  
Reply With Quote #9

Sorry for not using edit button... Just had to bump the thread up too

I know whats wrong... There isnt any command called set_user_name... So what command to change name with then?
XunTric is offline
TotalNoobScripter
Senior Member
Join Date: Aug 2004
Old 01-28-2005 , 21:39  
Reply With Quote #10

wow, there isnt a set_user_name!!!!!!!!!

client_cmd(players[i],"name ^"%s^"", Name)

?
TotalNoobScripter is offline
Send a message via AIM to TotalNoobScripter
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 19:19.


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