AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Seems to be an problem.. (https://forums.alliedmods.net/showthread.php?t=12668)

KyleD 04-21-2005 02:08

Seems to be an problem..
 
Ok, when I go to test this and select the a certain race it will show that I selected every single race. I was also wondering if someone could tell me how to make it so a player has to be a certain class to select a race. I tried the != but it didnt seem to work...

Code..

Code:
public do_chooserace(id,key)  {      if(key == 0) {          if((g_playerclass[id] = class_covenant) && (g_race[id] == race_grunt))          client_print(id,print_chat,"[HaloMod] You're already a Grunt. Select a different race.")          changerace(id)      } else if((g_playerclass[id] == class_covenant) && (g_race[id] == race_grunt)) {          client_print(id,print_chat,"[HaloMod] You are now a Grunt under the Convenants.")      } else if(g_playerclass[id] != class_covenant) {          client_print(id,print_chat,"[HaloMod] You must be a Covenant to select this.")      }      if(key == 1) {          if((g_playerclass[id] = class_covenant) && (g_race[id] == race_jackel))          client_print(id,print_chat,"[HaloMod] You're already a Jackel. Select a different race.")          changerace(id)      } else if((g_playerclass[id] = class_covenant) && (g_race[id] = race_jackel)) {          client_print(id,print_chat,"[HaloMod] You are now a Jackel under the Convenants.")      } else if(g_playerclass[id] != class_covenant) {          client_print(id,print_chat,"[HaloMod] You must be a Covenant to select this.")          return PLUGIN_HANDLED;      }      if(key == 2) {          if((g_playerclass[id] = class_covenant) && (g_race[id] == race_elite))          client_print(id,print_chat,"[HaloMod] You're already an Elite. Select a different race.")          changerace(id)      } else if((g_playerclass[id] = class_covenant) && (g_race[id] = race_elite)) {          client_print(id,print_chat,"[HaloMod] You are now an Elite under the Covenants.")      } else if(g_playerclass[id] != class_covenant) {          client_print(id,print_chat,"[HaloMod] You must be a Covenant to select this.")          return PLUGIN_HANDLED;      }      if(key == 3) {          if((g_playerclass[id] = class_spartan) && (g_race[id] == race_marine))          client_print(id,print_chat,"[HaloMod] You're already a Marine. Select a different race.")          changerace(id)      } else if((g_playerclass[id] = class_spartan) && (g_race[id] = race_marine)) {          client_print(id,print_chat,"[HaloMod] You are now a Marine under the Spartans.")      } else if(g_playerclass[id] != class_spartan) {          client_print(id,print_chat,"[HaloMod] You must be a Spartan to select this.")          return PLUGIN_HANDLED;      }      if(key == 4) {          if((g_playerclass[id] = class_spartan) && (g_race[id] == race_forerunner))          client_print(id,print_chat,"[HaloMod] You're already a Forerunner. Select a different race.")          changerace(id)      } else if((g_playerclass[id] = class_spartan) && (g_race[id] = race_forerunner)) {          client_print(id,print_chat,"[HaloMod] You are now a Forerunner under the Spartans")      } else if(g_playerclass[id] != class_spartan) {          client_print(id,print_chat,"[HaloMod] You must be a Spartan to select this.")          return PLUGIN_HANDLED;      }      ShowHUD(id)      return PLUGIN_HANDLED;  }

slurpycof 04-21-2005 05:19

try this
Code:
    if(key == 3) {         if((g_race[id] == race_marine)){             client_print(id,print_chat,"[HaloMod] You're already a Marine. Select a different race.")             changerace(id)         } else if((g_playerclass[id] = class_spartan)) {             client_print(id,print_chat,"[HaloMod] You are now a Marine under the Spartans.")             return PLUGIN_HANDLED         } else{             client_print(id,print_chat,"[HaloMod] You must be a Spartan to select this.")             changerace(id)         }     }

v3x 04-21-2005 13:37

Seems as though there's a lot of people making plugins involving races and such. :)

XxAvalanchexX 04-21-2005 15:20

ARGH!

Code:
if(variable = value)
will ALWAYS return true, just to let you know. You do this several times throughout your plugin. I can't say it's the cause of the problem, but it does create its own problems, liking making variable now equal value.

Dot.Infinity 09-23-2005 23:00

nice kyled, im impressed how hard your working on this plugin :wink:
i expect good progress from u .. keep up the good work

Xanimos 09-24-2005 00:28

I want to know how your making this plugin....like what similarities to halo are there. Becase 1) I thought everyone had given up on this mod 2) becuase I had my own ideas on what to do and i think i could help you.


All times are GMT -4. The time now is 10:01.

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