Raised This Month: $ Target: $400
 0% 

Compiler killer...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rolnaaba
Veteran Member
Join Date: May 2006
Old 05-20-2007 , 23:07   Compiler killer...
Reply With Quote #1

I think I created a compiler killer....
when i try to compile this plugin ii made with amxxpc.exe I get a windows error saying "amxxpc.exe has encountered a problem and needs to close", so i tried the web compiler...it said
Quote:
Originally Posted by Online Compiler
Your plugin failed to compile! Read the errors below:


200372 successful compiles to date.
110503 failed compiles to date.
Old compiler: 101980 compiles before decommission.
This tool by: David "BAILOPAN" Anderson.
As you can see there are no errors listed...what is up with my plugin?
It is attatched below...
Attached Files
File Type: sma Get Plugin or Get Source (FunMod.sma - 79 views - 35.3 KB)
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
pRED*
Join Date: Dec 2006
Old 05-20-2007 , 23:17   Re: Compiler killer...
Reply With Quote #2

Althought I doubt it'd help the CurWeapon event only has one 'r'. Not CurrWeapon.
pRED* is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 05-20-2007 , 23:20   Re: Compiler killer...
Reply With Quote #3

my bad typo...still killing compilers lol
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 05-21-2007 , 00:15   Re: Compiler killer...
Reply With Quote #4

Code:
get_random_weapon() {     new num = random_num(1, 25);     if(get_pcvar_num(pcvar[CDEBUG]) == 1) {         new tmp = get_gametime();         log_amx("[FunMod] Gametime: %i, GetRandomWeapon function called...info: num=%i", tmp, num);     }     switch(num) {         case 1: return "weapon_ak47"         case 2: return "weapon_aug"         case 3: return "weapon_awp"         case 4: return "weapon_deagle"         case 5: return "weapon_elite"         case 6: return "weapon_famas"         case 7: return "weapon_fiveseven"         case 8: return "weapon_g3sg1"         case 9: return "weapon_gali"         case 10: return "weapon_galil"         case 11: return "weapon_glock18"         case 12: return "weapon_m249"         case 13: return "weapon_m3"         case 14: return "weapon_m4a1"         case 15: return "weapon_mac10"         case 16: return "weapon_mp5navy"         case 17: return "weapon_p228"         case 18: return "weapon_p90"         case 19: return "weapon_scout"         case 20: return "weapon_sg550"         case 21: return "weapon_sg552"         case 22: return "weapon_tmp"         case 23: return "weapon_ump45"         case 24: return "weapon_usp"         case 25: return "weapon_xm1014"     } }

It crashing on your string return. I don't think you can do that. Return it byref.

Code:
new Hi[24]; get_random_weapon(Hi, 23); get_random_weapon(Hi[], len) {     //...     case 3:         copy(Hi, len, "weapon_awp");     //... }
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
Rolnaaba
Veteran Member
Join Date: May 2006
Old 05-21-2007 , 14:40   Re: Compiler killer...
Reply With Quote #5

yup that was the problem, thanks a lot teame06. I had a ton compiler errors in addittion to that but they all fixed now compiles fine BAILOPAN should fix that though...instead of craching compiler it should generate an error...
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 05-21-2007 , 20:58   Re: Compiler killer...
Reply With Quote #6

Quote:
Originally Posted by Sawce
Public functions cannot return strings. Change the function to a stock and it should compile just fine.
Compiler errors such as this are best handled by CompuPhase, the maintainers of Pawn. You should verify that the crash still occurs in their latest version first, as amxmodx uses an older version, if you want to submit it there.
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 05-21-2007 , 21:01   Re: Compiler killer...
Reply With Quote #7

Quote:
Originally Posted by teame06 View Post
Code:
new Hi[24]; get_random_weapon(Hi, 23); get_random_weapon(Hi[], len) {     //...     case 3:         copy(Hi, len, "weapon_awp");     //... }
Instead of doing that do something like this (since weaponnames are constant):

Code:
new gWeaponNames[2][] = {      "weapon_m4a1",      "weapon_ak47" }; // get a random weapon (notice we don't have to call a function :]). gWeaponNames[random(2)];

or somthing along those lines.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 05-21-2007 , 22:08   Re: Compiler killer...
Reply With Quote #8

so declare like this:
Code:
new g_WeaponNames[25] {     "weapon_ak47",     "weapon_aug",     "weapon_awp",     "weapon_deagle",     "weapon_elite",     "weapon_famas",     "weapon_fiveseven",     "weapon_g3sg1",     "weapon_gali",     "weapon_galil",     "weapon_glock18",     "weapon_m249",     "weapon_m3",     "weapon_m4a1",     "weapon_mac10",     "weapon_mp5navy",     "weapon_p228",     "weapon_p90",     "weapon_scout",     "weapon_sg550",     "weapon_sg552",     "weapon_tmp",     "weapon_ump45",     "weapon_usp",     "weapon_xm1014" };

but to get random one would I do:
Code:
g_WeaponNames[random_num(1, 25)];
or:
Code:
g_WeaponNames[random_num(0, 24)];
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 05-22-2007 , 02:34   Re: Compiler killer...
Reply With Quote #9

random(25) should work fine ;)
__________________
regalis is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 05-22-2007 , 07:51   Re: Compiler killer...
Reply With Quote #10

no...is
Code:
random(26)
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
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 10:43.


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