AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   errors 29 and 30 (https://forums.alliedmods.net/showthread.php?t=28815)

Mini_Midget 05-23-2006 07:05

errors 29 and 30
 
Code:

/home/users/amxmodx/tmp3/phpoc1ShG.sma(31) : error 035: argument type mismatch (argument 1)
/home/users/amxmodx/tmp3/phpoc1ShG.sma(31) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp3/phpoc1ShG.sma(31 -- 32) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp3/phpoc1ShG.sma(31 -- 32) : fatal error 107: too many error messages on one line

Compilation aborted.
4 Errors.
Could not locate output file /home/groups/amxmodx/public_html/websc3/phpoc1ShG.amx (compile failed).

and part of my script with the error
Code:
public client_infochanged(id)     {     new newName[33]     get_user_info(id,"name",newName,32)         if(get_user_frags("5")) && (contain(newName,"Cpl.") == -1)     {         get_user_info(id, "name",newName,32)                 client_print(id, print_chat, "Congratulations Private! You are now promoted to Corporal!")         format(newName,32,"Cpl. %s",newName)         client_cmd(id,"name %s",newName)     } } public client_putinserver(id)     client_infochanged(id)

Hawk552 05-23-2006 08:42

This is my best guess on what you're trying to do, but I don't know:

Code:
#include <amxmodx> #include <amxmisc> public client_infochanged(id) {     new newName[33]     get_user_info(id,"name",newName,32)           if(get_user_frags(id) >= 5 && contain(newName,"Cpl.") == -1)     {         get_user_info(id, "name",newName,32)                   client_print(id, print_chat, "Congratulations Private! You are now promoted to Corporal!")         format(newName,32,"Cpl. %s",newName)         client_cmd(id,"name %s",newName)     } } public client_putinserver(id)     client_infochanged(id)

Mini_Midget 05-23-2006 09:14

when i get 5+ frags and it says that i'm promoted
i look at the score board to see if my name was changed
it changed but just "Cpl."
no "Mini_Midget" or whats so ever
can't see where i went wrong now...
btw, thxs for the last post

Hawk552 05-23-2006 09:22

Quote:

Originally Posted by Mini_Midget
when i get 5+ frags and it says that i'm promoted
i look at the score board to see if my name was changed
it changed but just "Cpl."
no "Mini_Midget" or whats so ever
can't see where i went wrong now...
btw, thxs for the last post

Change the client_cmd to this:

Code:
client_cmd(id,"name ^"%s^"",newName)

Zenith77 05-23-2006 16:50

To preserve the old name, and replace w/e rank with Cpl.; you need to do this...

Code:
//a little snippet new oldName[32]; get_user_name(id, oldName, 31); if(containi(oldName, "Pvt.") > -1)      replace(oldName, 3, "Pvt.", ""); new name[32]; format(name, 31, "Cpl. %s", oldName);

:)

Hawk552 05-23-2006 20:02

Why don't you just replace Pvt. with Cpl., the end part you used is useless.

Mini_Midget 05-24-2006 05:29

thxs everyone who helped me out especially Hawk
the plugin works fine now and i added some things but now i've come across a bug in my plugin
when i start a new game, my name is Pte. Mini_Midget
(Pte. means Private) and when I get my first kill in the server, my rank
and name should change to "Cpl. Mini_Midget" but instead it changes to
"Cpl. Pte. Mini_Midget". i change my name and then it resets back to normal "Cpl. Mini_Midget"
btw, when a user connects, i can't get the client_print code to show in game

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN  "Army Ranks" #define VERSION "0.1" #define AUTHOR  "Mini_Midget" public plugin_init()     {     register_plugin(PLUGIN, VERSION, AUTHOR); } public client_connect(id)     {     new newName[33]     get_user_info(id,"name",newName,32)         if(containi(newName,"Pte.") == -1)         {         format(newName,32,"Pte. %s",newName)         set_user_info(id,"name",newName)           client_print(id, print_chat, "G'day Private %s", newName)     } } public client_infochanged(id)     {     new newName[33]     get_user_info(id,"name",newName,32)         if(get_user_frags(id) >= 1 && containi(newName,"Cpl.") == -1)         {         format(newName,32,"Cpl. %s",newName)         set_user_info(id,"name",newName)           client_print(id, print_chat, "Congratulations Private! You are now promoted to Corporal!")     } } public client_putinserver(id)     set_task(20.0,"client_infochanged",id)
i forgot to credit hawk for doing the part when a user connects and he changes his name
http://forums.alliedmods.net/showthread.php?t=28761

Hawk552 05-24-2006 08:27

You should have read what Zenith said.

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN    "Army Ranks" #define VERSION    "0.1" #define AUTHOR    "Mini_Midget" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR) } public client_connect(id) {     new newName[33]     get_user_info(id,"name",newName,32)         if(containi(newName,"Pte.") == -1)     {         format(newName,32,"Pte. %s",newName)         set_user_info(id,"name",newName)             client_print(id, print_chat, "G'day Private %s", newName)     } } public client_infochanged(id)   {       new newName[33]     get_user_info(id,"name",newName,32)         if(get_user_frags(id) >= 1 && containi(newName,"Cpl.") == -1)     {         if(containi(newName,"Pte.") != -1)         {             replace(newName,32,"Pte.","Cpl.")             set_user_info(id,"name",newName)                         client_print(id, print_chat, "Congratulations Private! You are now promoted to Corporal!")         }         else         {               format(newName,32,"Cpl. %s",newName)             set_user_info(id,"name",newName)                           client_print(id, print_chat, "You are now promoted to Corporal!")         }     } }   public client_putinserver(id)       set_task(20.0,"client_infochanged",id)

Mini_Midget 05-24-2006 08:30

i kinda didn't understand zenith (no offence) so i just played around with the script and got it to work after like 20mins of screwing wiht it :lol:
btw, in the script, what does this symbol do "^"???

Hawk552 05-24-2006 08:32

Quote:

Originally Posted by Mini_Midget
i kinda didn't understand zenith (no offence) so i just played around with the script and got it to work after like 20mins of screwing wiht it :lol:
btw, in the script, what does this symbol do "^"???

In this console, you can do:

Code:

amx_ban 0 "player name" "you are an idiot"
But in Pawn, look at how the syntax highlighting fucks up when we use quotes inside it:

Code:
server_cmd("ban 0 "player name" "you are an idiot"")

Why? Because quotes signify the end of the string. So, what we do is use an "escape character", which is ' ^" '.

Code:
server_cmd("ban 0 ^"player name^" ^"you are an idiot^"")


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

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