AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   What did i do wrong? Help me with this script (https://forums.alliedmods.net/showthread.php?t=9617)

XunTric 01-25-2005 11:47

What did i do wrong? Help me with this script
 
I made (tryed to make) my first script ever today. And of course it dont work :lol:. 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     }

PM 01-25-2005 12:06

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)

XunTric 01-25-2005 12:51

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     }

Geesu 01-25-2005 14:13

Code:
retrun PLUGIN_HANDLED

should be

Code:
return PLUGIN_HANDLED

Come on man u can find spelling errors :P

XunTric 01-25-2005 15:00

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     }

BlueRaja 01-25-2005 16:56

No, spacing doesn't matter..
As for the script: This, JGHG, is exactly why I created find.inc.

Peli 01-25-2005 20:17

Can we see the error? It tells you the exact line...

XunTric 01-26-2005 08:01

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 01-27-2005 15:50

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

I know whats wrong... There isnt any command called set_user_name... So what command to change name with then?

TotalNoobScripter 01-28-2005 21:39

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

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

?


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

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