Author Topic: Getting The Player Skin  (Read 4307 times)

0 Members and 1 Guest are viewing this topic.

Offline Mex

  • Wiseguy
  • **
  • Posts: 63
    • View Profile
Getting The Player Skin
« on: August 18, 2007, 03:03:33 pm »
Ok I need to get the players skin, for a !skin command and other reasons

So I thought, simple..

on *:SIGNAL:vcmp.spawn:{
  vcmp.say $vcmp.name(%id) Spawned As A ' $+ $readini(SkinLocations.ini,Skins,$vcmp.location(%id)) $+ '.
}

Obviously the ini would contain skin spawns locations and their names..
like:
[Skins]
Location=SkinName

So I tested it, but the problem was it was reading the location too early :\
only a few miliseconds, but enough to read the wrong location..

So I thought ok ill do area instead of location.

This time I had the same problem with it reading the area to early.

So I tried a timer:
.timerspawn 1 1 vcmp.say $vcmp.area(%id)
also
.timerspawn 1 20 vcmp.say $vcmp.area(%id)

I found out it reads the area at the start of the timer.. then says the area at the time specified.

Which is useless as I need it to read the area after the specified time.

If anyone can help me with this I would really apreciate it,

Thanks,
Mex.

Offline Mex

  • Wiseguy
  • **
  • Posts: 63
    • View Profile
Re: Getting The Player Skin
« Reply #1 on: August 19, 2007, 01:36:38 am »
Sorted on MSN, Thanks Tommis.

For anyone that wants to know,
you need to put a timer to an alias.

Offline Chezor

  • Wiseguy
  • **
  • Posts: 90
  • RPG Planet Scripter
    • View Profile
    • RPG Planet
Re: Getting The Player Skin
« Reply #2 on: September 13, 2008, 08:08:53 pm »
I dont get this thing, I also want the same cmd as mex .. the !skin cmd

my code is

Code: [Select]
alias vcmp.findskin {
  if (City Hall isin $vcmp.area(%id)) {
    !writeini -n vcmp.skin.ini SKINS $vcmp.getid($1) Citizen
    vcmp.msg %id You spawned as a Citzen.
  }
  elseif (Police isin $vcmp.area(%id)) {
    !writeini -n vcmp.skin.ini SKINS $vcmp.getid($1) Cop
    vcmp.msg %id You spawned as a Cop.
  }
}

and

Code: [Select]
on *:SIGNAL:vcmp.spawn:{
  var %name = $1
  var %id = $vcmp.getid($1)

  $vcmp.findskin(%id)
}

but if we spawn as citizen and then spawn as cop. It detects the location where we died and not where we spawned. So it will say you spawned as citizen. if i spawn as cop..
I dont prefer to create new topic as this topic is already there.. (i know this is too old topic :P )

Scripts: Fuel system in vehicles, Speedometer, Spawnback, Improved Copwork, Improved Jailing, Improved phone with sms, and many more. Coming soon..

Offline Tommis

  • VC:MP Beta Tester (inactive)
  • Wiseguy
  • *
  • Posts: 56
    • View Profile
Re: Getting The Player Skin
« Reply #3 on: September 13, 2008, 08:12:57 pm »
Hey,

Try this;

Code: [Select]

alias vcmp.before.findskin {

  ;$1 == ID
  ;$2 == NAME

  timer -m 1 1000 vcmp.findskin $1-
}
alias vcmp.findskin {

  ;$1 == ID
  ;$2 == NAME

  if (City Hall isin $vcmp.area($1)) {
    !writeini -n vcmp.skin.ini SKINS $1 Citizen
    vcmp.msg $1 You spawned as a Citzen.
  }
  elseif (Police isin $vcmp.area($1)) {
    !writeini -n vcmp.skin.ini SKINS $1 Cop
    vcmp.msg $1 You spawned as a Cop.
  }

}



Code: [Select]
on *:SIGNAL:vcmp.spawn:{
  var %name = $1
  var %id = $vcmp.getid($1)

  timer -m 1 500 vcmp.before.findskin %id %name
}

It basically waits a second then does it. Should give the scripts enough time to update the data with regards to location.

Regards,
Tommis
« Last Edit: September 13, 2008, 08:45:56 pm by Tommis »

Offline Punjabi

  • Made Man
  • ***
  • Posts: 147
  • Config Editor
    • View Profile
    • PUN Clan
Re: Getting The Player Skin
« Reply #4 on: September 16, 2008, 11:07:58 am »
Thanks tommis i really need this for my GUS..... ::)
GOD BLESS ALL..<<Founder of PUN Clan.....Born to fight and Kill..>>