AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   setting conditions for variables to be changed for each map (https://forums.alliedmods.net/showthread.php?t=10472)

Stealth Penguin 02-20-2005 10:41

setting conditions for variables to be changed for each map
 
How would I go about making a variable that would hold the map name in it? I can't seem to get the condition right. If someone could tell me that would be very helpfull. Here is what I have so far:
get_mapname(mapname,32)
Code:
    get_mapname(mapname,32)     if ( mapname = "de_aztec")     {         copy(o1n, 33, "CT Spawn")         copy(o2n, 33, "T Spawn")         copy(o3n, 33, "Int Double Doors")         c0X=float(-3237)         c0Y=float(-1233)         c0Z=float(-171)         c1X=float(2448)         c1Y=float(277)         c1Z=float(-252)         c2X=float(-1113)         c2Y=float(-1584)         c2Z=float(-188)     }

EKS 02-20-2005 10:43

use
if(equal(MyString,"de_aztec"))

BlueRaja 02-20-2005 13:55

Isn't there already a plugin to use different configuation files for different maps?

XxAvalanchexX 02-20-2005 14:52

Firstly, you have to declare the variable. Secondly, the = operator sets a value, it doesn't compare a value. And thirdly, you can't use the == operator in Small to compare strings.

Oh, and fourthly, no need to use float(integer), just put it as a float in the first place.

Code:
new mapname[32] get_mapname(mapname,31) if (equali(mapname,"de_aztec")) {     copy(o1n, 33, "CT Spawn")     copy(o2n, 33, "T Spawn")     copy(o3n, 33, "Int Double Doors")     c0X=-3237.0     c0Y=-1233.0     c0Z=-171.0     c1X=2448.0     c1Y=277.0     c1Z=-252.0     c2X=-1113.0     c2Y=-1584.0     c2Z=-188.0 }

Stealth Penguin 02-20-2005 23:16

Thank you very much

Stealth Penguin 02-20-2005 23:36

hmm, when I tried to compile that it gave me these two errors:
/home/users/amxmodx/tmp/phpOjp12V.sma(39) : error 021: symbol already defined: "get_mapname"
/home/users/amxmodx/tmp/phpOjp12V.sma(40) : error 010: invalid function or declaration

Any ideas about what to do?

XxAvalanchexX 02-21-2005 00:18

You didn't put it in a public function?

Stealth Penguin 02-21-2005 14:15

Ah, that fixed part of the problem but its still giving me tag mismaches.

Stealth Penguin 02-21-2005 15:58

oh man, I thought everything was going well here until I suddenly got 27 errors, now I'm stuck. Please tell me whats wrong with the last few menus towards the bottom?

XxAvalanchexX 02-21-2005 16:19

Your tag mismatches comes from creating your c* variables as integers but assigning them as floats. You have to create them as Float:c* to make them a float.


All times are GMT -4. The time now is 14:15.

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