Jump to content

Can you make a variable have a name like "legs"?


Recommended Posts

okin the game mods section i'm trying to make an addition to the attack part, however i'm at a roadblock.

You know how the $mydamage is like a variable or whatever.

Could i have a


where it chose a random number and then lets say the number is one then it sets $attackspot to "legs" or does it have to be a number? i have the base code down but thats something i've come across.

ALSO how can i make it so i include 2 files in the attack file. because it alraedy has the globals file included and i need to include a file i have and if i just copy the way they include globals but change the name it shows an error.

Link to comment
Share on other sites

Re: Can you make a variable have a name like "legs"?


$spot = rand(1,3);
switch ($spot) {
case 1: $attackspot = 'legs';
case 2: $attackspot = 'arms';
case 3: $attackspot = 'head';
default: // no default

echo "You attacked {$r['username']} and hit their $attackspot doing $mydam damage.";


It sounds like you're looking for something like that.

You can include hundreds of files into one script.

It acts as if the script was already in the script. So, you have to make sure they jive together, or else you get errors...

Hope that helps...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...