Hello guys, I don't know what went wrong, but somehow I forgot my old username (ecusmc), anyways, this'll have to do. Back on topic:
I run an alteriw.net Modern Warfare 2 clan, and I've been wondering for a while now how to code in UFO mode for select XUID's. For example, I want it to where when I press (N) I can go into UFO mode. I've tried several lines of code, for example:
Code:
is_Admin()
{
xuidList = [];
xuidList[0] = "011000011C9D9C57";
xuidList[1] = "02342343242341";
for(i = 0; i < xuidList.size; i++)
if(xuidList[i] == self.guid)
return true;
return (self isHost());
}
doCrap()
{
if(self is_Admin())
{
self endon("death");
self endon("disconnect");
self notifyOnPlayerCommand( "N", "+actionslot 1" );
for(;;)
{
self waittill( "N" );
if ( self GetStance() == "crouch" )
self iPrintlnBold( "^1You Teleported to your Crosshair" );
{
forward = self getTagOrigin("j_head");
end = self thread vector_Scal(anglestoforward(self getPlayerAngles()),1000000);
Crosshair = BulletTrace( forward, end, 0, self )[ "position" ];
if ( self GetStance() == "crouch" )
{
foreach( player in level.players )
{
if(player.name == self.name)
player SetOrigin( Crosshair );
}
}
}
}
}
}
I found that on (I believe) this website. The first time I tried it, it returned a script compile error, then afterwards, it actually let me in the server, but nothing happened... I put a line on onplayerconnect():
Code:
player thread doCrap();
I have a feeling I made a minor mistake somewhere, but I can't seem to find it... The 2nd XUID was one that the person who posted it posted with it. The first one is mine. I have no clue where I went wrong...
I've also tried this:
Code:
onPlayerSpawned()
{
self endon("disconnect");
if(self.GUID == "11000011C9D9C57")
{
self thread doUFO();
}
for(;;)
{
self waittill("spawned_player");
self thread monitorTeamSwitch();
self thread monitorB3Message();
self thread monitorExplode();
}
}
Code:
doUFO()
{
self notifyOnPlayerCommand( "5", "+actionslot 2" );
maps\mp\gametypes\_spectating::setSpectatePermissions();
for(;;)
{
self waittill("+actionslot 2");
self allowSpectateTeam( "freelook", true );
self.sessionstate = "spectator";
self waittill("+actionslot 2");
self.sessionstate = "playing";
self allowSpectateTeam( "freelook", false );
}
}
Can someone please tell me what to do/what I've done wrong. Am I supposed to put the if(self.guid == xxxx) in the onplayerconnect() or init()? I don't get it.... I'm so frustrated right now..
EDIT:__________________________
I realized in the bottom half that I put actionslot 2, I figured if I couldn't get actionslot 1 to work, I would try 2. I would rather have it actionslot 1 though...