![]() |
Some questions
So im looking at one of xXziroXx's old scripts and i had some questions
Quote:
PHP Code:
PHP Code:
Lastly can SPC be used instead of "@"? |
SPC is another option for concatenating strings, yes, but I think most scripters prefer to avoid it. I could be wrong.
This post should help explain the foreach loop he used. The index function returns -1 if the item does not appear in the array. |
Thanks that link had great examples, final question and i think i got this part understood.
Could you do this PHP Code:
PHP Code:
|
Quote:
for (element: array) { } |
Quote:
PHP Code:
I don't really like how he's doing that anyway. This is how I would have done it: PHP Code:
I'm not really sure how to explain the problems with yours except that it's just not following the right format. If you've got more questions I can try to answer them. Also check out Jer's post on arrays. |
When you say it reaches the number of bodyparts you mean the number assigned from the array? So skin would be 0, coat 1, etc..
Im hoping to get a RC on testbed soon so that i can trial and error this myself |
Quote:
|
Im trying to do a script where if someone with a staff level 2 or higher says "/kill <account>" it does so.
The script worked before I added the staff level requirement. Also can you show me where i would add an else statement for those who aren't level 2 or higher? I am trying to make it say "Not Allowed". At one point it was making my text "Not Allowed" no matter what i said unless i said "/kill <account>" so i think i was close. PHP Code:
|
Nothing wrong with it that I can see, except that you'll want to do the checks serverside.
PHP Code:
The reason I inserted another if statement was so you could use the else clause properly. If you'd used && instead, then the else would also apply if the command wasn't "/kill". Also, be sure to work on your styling. Two spaces is an indent. |
Hm i can't seem to get the script to work. I made sure i have a high enough staff level and i even swapper that part out for my account name to see if that would work, but still no luck
PHP Code:
|
You have to tokenize the player's chat before you check tokens[0]—otherwise, the array doesn't exist yet.
PHP Code:
|
Can strings like clientr. and client only be numbers? When I do scripts such as the following, they don't appear in attributes.
PHP Code:
|
Quote:
since client.high3 wouldn't exist, evaluating if(client.high3) would return false since no value is attached to it |
Quote:
PHP Code:
PHP Code:
Setting a value to true will show it equal to 1. Setting it to false will either show it equal to 0 or remove it from attributes altogether. Either works. If a variable has never been set to false, it will by default be false. |
Correct me if I'm wrong but float( false) would make it show 0 in the flags list.
|
All times are GMT +2. The time now is 04:06 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.