Raised This Month: $51 Target: $400
 12% 

case 0-100: (?)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xBreak^
BANNED
Join Date: Jul 2009
Old 07-19-2009 , 16:54   case 0-100: (?)
Reply With Quote #1

Hello im making a plugin and i wanna use switch..
How can i do something like:

Code:
new g_Points[33], g_Rank[33] switch (g_Points[id] {           case 0-100: // If player has 0 to 100 points...           {                   g_Rank[id] = 1;            } }

Or this is allowed?
xBreak^ is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-19-2009 , 16:55   Re: case 0-100: (?)
Reply With Quote #2

case 0..100:
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
xBreak^
BANNED
Join Date: Jul 2009
Old 07-19-2009 , 16:55   Re: case 0-100: (?)
Reply With Quote #3

thank you! and sorry for my bad english
xBreak^ is offline
SchlumPF*
Veteran Member
Join Date: Mar 2007
Old 07-19-2009 , 17:14   Re: case 0-100: (?)
Reply With Quote #4

this question is already answered in the documentary.
__________________
SchlumPF* is offline
Send a message via ICQ to SchlumPF*
xBreak^
BANNED
Join Date: Jul 2009
Old 07-19-2009 , 17:33   Re: case 0-100: (?)
Reply With Quote #5

when i use this method my plugin dont finish to compile never...

can i use

if ( g_Points[id] = 0..100)
xBreak^ is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-19-2009 , 17:35   Re: case 0-100: (?)
Reply With Quote #6

Show your code.

But if you use just that, you can use something like : if ( 0 <= g_Points[id] <= 100 )
__________________
Arkshine is offline
xBreak^
BANNED
Join Date: Jul 2009
Old 07-19-2009 , 17:38   Re: case 0-100: (?)
Reply With Quote #7

Code:
if ( g_ammopacks[id] == 0..100)     {         g_Level[id] = 1;     }     else if ( g_ammopacks[id] == 101..1000)     {         g_Level[id] = 2;     }

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Error: Expected token: ")", but found ".." on line 1410
Error: Invalid expression, assumed zero on line 1410
Warning: Expression has no effect on line 1410
Error: Expected token: ";", but found ")" on line 1410
Error: Too many error messages on one line on line 1410

Compilation aborted.
4 Errors.
Could not locate output file C:\Archivos de programa\Valve\cstrike\addons\amxmodx\scripti ng\zombie_plague40.amx (compile failed).
xBreak^ is offline
Old 07-19-2009, 17:42
xBreak^
This message has been deleted by xBreak^. Reason: double post
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-19-2009 , 17:44   Re: case 0-100: (?)
Reply With Quote #8

Using a switch()

Code:
switch ( g_ammopacks[id] ) {     case 0 .. 100    : g_Level[id] = 1;     case 101 .. 1000 : g_Level[id] = 2; }

But for large number, it's recommended to use something like :

Code:
new AmmoPacks = g_ammopacks[id]; if ( AmmoPacks <= 100 ) {     g_Level[id] = 1; } else if ( AmmoPacks <= 1000 ) {     g_Level[id] = 2; }
__________________

Last edited by Arkshine; 07-19-2009 at 17:49.
Arkshine is offline
xBreak^
BANNED
Join Date: Jul 2009
Old 07-19-2009 , 17:46   Re: case 0-100: (?)
Reply With Quote #9

Thanks you !
xBreak^ 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 06:50.


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