[HELP] Weapon adding script + plugin script modify

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
Szabolcs271
CJ Wannabe
CJ Wannabe
Posts: 4
Joined: December 28th, 2012, 1:45 pm

[HELP] Weapon adding script + plugin script modify

Post by Szabolcs271 » January 13th, 2013, 6:21 pm

Hello. I really need help to solve this 2 scripts.

init( modVersion )
{
braxi\_dvar::addDvar( "ua_weapon", "ua_weapon", "saw_acog_mp", "", "", "string" );

precacheItem( level.dvar["ua_weapon"] );
while( 1 )
{
level waittill( "player_spawn", player );

if( player.pers["admin"] )
{
player giveWeapon( level.dvar["ua_weapon"] );
player giveMaxAmmo( level.dvar["ua_weapon"] );
}
}
}

This plugin add saw_acog when somebody logged into admin panel. How to add in the script a "player getGuid () == "*****"" to work on the server?


case "giveweap":
player = getPlayer( arg1, pickingType );
if( isDefined( player ) && player isReallyAlive() )
{
if( !player isReallyAlive() )
{
return;
}
player giveWeapon( "saw_acog_mp" );
player giveMaxAmmo( "saw_acog_mp" );
player SwitchToWeapon( "saw_acog_mp" );
player iPrintlnBold( "^5Az ^2Admin ^5fegyvert adott neked" );
}
break;
This is a command in the rcon. How to add in the script a variable after the giveweap command to enable giving EVERY weap to a player? (The player ID is arg1 )


Thanks for help!

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: [HELP] Weapon adding script + plugin script modify

Post by F |Madness| U » January 13th, 2013, 6:58 pm

I'm not really sure what you're asking. I assume you want to replace the admin panel thing simply by if somebody has a certain guid, you want to give them such and such.

If you want to give a person with a certain guid EVERY weapon (not sure if you mean different attachments etc as well) you would want to check the player's guid and then do a loop giving them each weapon from an array of weapons. See below.

Code: Select all

init
{
        //......
        level thread weaponlist();
}
 
onSpawn
{
        level waittill("spawned",player);
        if(player getGuid() == "xxxxxx")
                player thread giveWeapons();
}
 
weaponlist
{
        level.weaponarray = [];
        level.weaponarray[0] = "mp5_mp";
        level.weaponarray[1] = "ak74u_mp";
        //etc...
}
 
giveWeapons
{
        for(i=0;i<level.weaponarray.size;i++)
        {
                self giveWeapon(level.weaponarray[i]);
                wait 0.02;
        }
}
-

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests