AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   argument type mismatch & loose indentation problem :/ (https://forums.alliedmods.net/showthread.php?t=9476)

Damocles 01-20-2005 10:54

argument type mismatch & loose indentation problem :/
 
Hey,

Can someone tell me why im getting type mismatch values for the send_msg function. This is how id do it in Java apart from specifying the type of the parameter. Im getting these errors:

Code:

/home/users/amxmodx/tmp/phpSiEYQW.sma(79) : warning 217: loose indentation
/home/users/amxmodx/tmp/phpSiEYQW.sma(103) : error 035: argument type mismatch (argument 2)
/home/users/amxmodx/tmp/phpSiEYQW.sma(106) : warning 217: loose indentation
/home/users/amxmodx/tmp/phpSiEYQW.sma(108) : error 035: argument type mismatch (argument 2)

p.s. HOW THE HELL do i get rid of the loose indentation, ive gone to extremes with my indentation and its still moaning :(

Code:
public send_msg(id, rateType, rateValue) { // code here }

Code:
public client_putinserver(id) {         new rate[16]     new cl_updaterate[16]     // Get users rate value     get_user_info(id, "rate", rate, 15)     // Get users updaterate value     get_user_info(id, "cl_updaterate", cl_updaterate, 15)     // If rate < set rate, inform admins     if ((str_to_num(rate)) < MIN_RATE)     {         send_msg(id, "rate", rate)     }     // If cl_updaterate < set cl_updaterate, inform admins     if ((str_to_num(cl_updaterate))<MIN_CLUPDATERATE)     {           send_msg(id, "cl_updaterate", cl_updaterate)     }     return PLUGIN_HANDLED }

Thanks for any help :)

Da Bishop 01-20-2005 15:14

Indent warnings mean nothign at all. If they really bother you add this to your script

Code:
#pragma tabsize 0

I not sure where you are going with the send_msg but perhaps you may try this.

Code:
new playername[51] get_user_name(id, playername, 50) client_print(0, print_chat, "User %s has a rate of %s", playername, rate)

Damocles 01-20-2005 15:38

the send message function is used to print out to all the admin currently connected that either the players rate or updaterate are below a set value. Thats why i put the code in the send_msg function because its essentially the same code but simply changes based on whether the rate or the updaterate values are 'dodgy'

Im trying to pass it a string of which value is suspect so that it can be used to print out to the admins which value needs changing...and thats the output i get :(

Da Bishop 01-20-2005 16:42

From what i know there is no send_msg. But you could do something like this

Code:
for(new i = 0; i>0, i<32, ++i) { if(get_user_flags(i) & ADMIN_IMMUNITY) client_print(i, print_chat, " %s Rate is %s", playername, rate)    }

of course assigning a name to player name and rate to rate.

Damocles 01-21-2005 04:27

lol

I know there is no send_msg function in the amx libraries. I have written my own function....which i take it is perfectly valid in small as it is in any other language :)

Here is the code just so you can see what it does. Like i said before its just to remove the need to write the code over again

Code:
public send_msg(id, rateType, rateValue) {       new playerName[32]     new strMesg[128]     get_user_name(id,playerName,31)     format(strMesg,127,"[WARNING] - %s has a low %s value (%s)",playerName, rateType, rateValue)     // Inform any current admins of users low rate     new players[32], inum, playerid     // Get all the players     get_players(players,inum)                       // For each player, check if they are an admin in order to know who to send msg to     for(new i = 0; i < inum; ++i)     {         playerid = players[i]         if (!(get_user_flags(playerid)&ADMIN_CHAT))         {                           client_print(playerid,print_chat,strMesg)         }     }     }

Heopfully this will make it clearer for you to see what im trying to do bishop :)

Geesu 01-21-2005 07:56

It should be rateType[]

Code:
public send_msg(id, rateType[], rateValue) {       new playerName[32]     new strMesg[128]     get_user_name(id,playerName,31)     format(strMesg,127,"[WARNING] - %s has a low %s value (%s)",playerName, rateType, rateValue)     // Inform any current admins of users low rate     new players[32], inum, playerid     // Get all the players     get_players(players,inum)                       // For each player, check if they are an admin in order to know who to send msg to     for(new i = 0; i < inum; ++i)     {         playerid = players[i]         if (!(get_user_flags(playerid)&ADMIN_CHAT))         {                           client_print(playerid,print_chat,strMesg)         }     }     }

Damocles 01-21-2005 08:28

ahhh Geesu your a GENIUS :) ty

Da Bishop 01-21-2005 09:18

Ah well see, there is always good thing to show all your codes ;). If you still get indent warnings (which you probably will) and if really hate seeing them. I suggest the

#pragma tabsize 0

method.

PM 01-21-2005 10:24

Umm, I'd rather suggest correct intentdation ;)

Da Bishop 01-21-2005 10:33

Quote:

Originally Posted by PM
Umm, I'd rather suggest correct intentdation ;)

O, so you'd rather be the wise guy. Always getting on peoples case. Just cause you think you better then them. With your fancy PM name. :twisted:


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

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