Quote:
Originally Posted by Damien
I suck at scripting, this is what i got. can i have some help?
PHP Code:
//CLIENTSIDE
function onCreated()
{
this.stafflist = {
"Manager"
"Staff"
"Etc"
}
if (player.guild = this.stafflist)
{
showimg ("stafficon.png", player.x-0.04, player.y-3.3)
)
}
|
You need to use
//#CLIENTSIDE and not
//CLIENTSIDE for starting the clientside portion.
You need a semicolon (; ) after using any commands or setting something. That means that this doesn't apply to a function, check, loop, etc.
Example
PHP Code:
player.chat = "I just set the player's chat.";
Arrays need a comma (,) in-between strings and variables.
Example
PHP Code:
temp.array = { "string 1","string 2",26,5 };
A check requires (or should
)
== instead of
=, which is for setting something.
Example
PHP Code:
this.check = "pie";
if (this.check == "pie") {
//code
}
Since you are checking if the player's guild is in an array and not a specific string, you need to use
in instead of
== for the check.
Example
PHP Code:
temp.array = { 1,2 };
if (this.action in temp.array) {
//code
}
showImg() has 4 params:
integer (for ID), string (the image's file name), float (x coordinate), float (y coordinate)
Example
PHP Code:
showImg(200,"block.png",player.x,player.y);
And I'm sure your last mistake was a typo, which is that you accidentally closed a check with
) instead of
}.
Here is the correct code (I use my own styling, you don't necessarily have to follow it):
PHP Code:
//#CLIENTSIDE
function onCreated() {
temp.staffList = { "Manager","Staff","Etc" };
if (player.guild in temp.staffList)
showImg(200,"stafficon.png", player.x-0.04, player.y-3.3);
}
I used a
temp array instead of a
this array since it is only called inside that one function (
onCreated()).
Anyways, you should make a Gani script set as a
player.attr[] for this.