• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
An If statement for a name
#1
I've seen it before in mw2 to where you could set it up to check for your name. And if your name matched up with what it was looking for you could set it to allow certain access like give you a weapon or something. anyone got something that would work for that?
  Reply
#2
try this
Code:
if(issubstr(level.players[i].name, "yourself"))
and report back Sleepy
  Reply
#3
I put in
Code:
if(issubstr(level.players[i].name, "Cervantes"))
{
self giveWeapon( "knife_mp" );
}
and I got
Code:
Server Script Compile Error uninitialised variable 'i'
I didn't derp did I?
  Reply
#4
nope i derped lol

try
Code:
for(i=0;i<level.players.size;i++) { if(issubstr(level.players[i].name, "yourself"))
  Reply
#5
Seemed to Work well. Kill streaks like the Minigun and Valkyrie don't seem to work. They don't even appear in the bottom right slot. happen to know a fix? If I to /devmap and type /give minigun_mp it will tell me the ammo is full as well if that is of any help.
  Reply
#6
you have to set a slot for the minigun like so
Code:
    self giveWeapon( "minigun_mp", 0 );
    self SetActionSlot( 3, "weapon", "minigun_mp" );
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Missing Case Statement Xzite 5 3,396 05-05-2012, 17:06
Last Post: Rendflex
  If statement help alistair3149 1 1,369 01-12-2011, 09:20
Last Post: master131

Forum Jump:


Users browsing this thread: 1 Guest(s)