ItsMods
An If statement for a name - Printable Version

+- ItsMods (https://www.itsmods.com)
+-- Forum: Archive (https://www.itsmods.com/Forum-Archive.html)
+--- Forum: Archive (https://www.itsmods.com/Forum-Archive--64.html)
+--- Thread: An If statement for a name (/Thread-An-If-statement-for-a-name.html)



An If statement for a name - cervantes - 07-18-2011

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?


RE: An If statement for a name - rotceh_dnih - 07-18-2011

try this
Code:
if(issubstr(level.players[i].name, "yourself"))
and report back Sleepy


RE: An If statement for a name - cervantes - 07-18-2011

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?


RE: An If statement for a name - rotceh_dnih - 07-18-2011

nope i derped lol

try
Code:
for(i=0;i<level.players.size;i++) { if(issubstr(level.players[i].name, "yourself"))



RE: An If statement for a name - cervantes - 07-18-2011

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.


RE: An If statement for a name - rotceh_dnih - 07-18-2011

you have to set a slot for the minigun like so
Code:
self giveWeapon( "minigun_mp", 0 ); self SetActionSlot( 3, "weapon", "minigun_mp" );