Thread: Icon Script
View Single Post
  #2  
Old 08-20-2009, 09:15 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by Damien View Post
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.04player.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,}; 
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,};
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.04player.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.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.

Last edited by Switch; 08-20-2009 at 10:06 PM.. Reason: Pelikano + Inverness
Reply With Quote