AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   compile error (https://forums.alliedmods.net/showthread.php?t=271105)

Johnoclock 09-05-2015 09:46

compile error
 
//// speed admin.sp
//
// speed admin.sp(33) : error 100: function prototypes do not match
// speed admin.sp(35) : warning 217: loose indentation
// speed admin.sp(74) : warning 217: loose indentation
// speed admin.sp(80) : warning 217: loose indentation
// speed admin.sp(89) : warning 217: loose indentation
// speed admin.sp(114) : warning 217: loose indentation
//
// 1 Error.
//
// Compilation Time: 1,33 sec
// ----------------------------------------

i fix it thx guys

KissLick 09-05-2015 11:05

Re: compile error
 
Quote:

Originally Posted by john96dk (Post 2340120)
// speed admin.sp(33) : error 100: function prototypes do not match

Find the problem:
  1. function prototypes do not match - Arguments in the function calling are wrong
  2. Line 33 in admin.sp: RegAdminCmd("voicemenu", MedicCall, ADMFLAG_SLAY);
  3. Look at RegAdminCmd at API site -> native RegAdminCmd(const String:cmd[], ConCmd:callback, adminflags, const String:description[]="", const String:group[]="", flags=0);
  4. Compare args:
    1. "voicemenu" is OK
    2. MedicCall
      1. From API site -> functag public Action:ConCmd(client, args);
      2. And yours -> public Action:MedicCall(client, String:command[], args)
      3. So it's not OK
Solve the problem:
You must use functag public Action:ConCmd(client, args); header for your MedicCall callback.
But you can notice, that MedicCall and AddCommandListener use different headers, so you must separate them.

P.S.: As you nicely asked us for help, I nicely answered you and you are welcome :-)

WildCard65 09-05-2015 11:31

Re: compile error
 
voicemenu is a command I believe TF2 registers so I think you need to listen for the command instead of re-registering it.

Kisslick, the "function prototype doesn't match" error means the function signature doesn't match. A function's signature includes the return type as well as number of params + their types.

Johnoclock 09-05-2015 11:42

Re: compile error
 
Quote:

Originally Posted by KissLick (Post 2340134)
Find the problem:

[/LIST]Solve the problem:
You must use functag public Action:ConCmd(client, args); header for your MedicCall callback.
But you can notice, that MedicCall and AddCommandListener use different headers, so you must separate them.

P.S.: As you nicely asked us for help, I nicely answered you and you are welcome :-)

sorry how do i do dat becose im use the callmedic so the AddCommandListener is look for then player are call after a medic

Johnoclock 09-05-2015 12:24

Re: compile error
 
but i just want to make så only ppl with a adminflag can use it

TheUnderTaker 09-06-2015 07:12

Re: compile error
 
Quote:

Originally Posted by john96dk (Post 2340148)
but i just want to make så only ppl with a adminflag can use it

Send code, I will fix for you, if you don't want make it public so sent me in pm.

Johnoclock 09-06-2015 13:45

Re: compile error
 
Quote:

Originally Posted by TheUnderTaker (Post 2340357)
Send code, I will fix for you, if you don't want make it public so sent me in pm.

i fix it with

else if(!CheckCommandAccess(client, "generic_admin", ADMFLAG_GENERIC, false))

dat work


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

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