Spawn weapon dropped
#1

Is possible to spawn on some map island weapons on ground? Like spawned weapons able to collect?

I have inventory sys and else, but idk how to spawn weapons on ground
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=276222

https://sampwiki.blast.hk/wiki/CreatePickup
Reply
#3

yeah it's possible, do you have a drop/pick system created?
if yes, just drop the weapons wherever you want and if not, just create a drop system.
Reply
#4

Nah, you didnt understand me.. i dont want on pickup...

http://i50.tinypic.com/v83hxi.jpg

I need create weapons on ground like that. Without pickup

EDIT: Yes, i have Drop/Pick system... but idk how to create them on ground, not on pickup
Reply
#5

can u show me a one simple from dropping?
Reply
#6

Код:
CMD:dropgun( playerid, params[] ) {
	if( PlayerInfo[ playerid ][ xLevel ] < 3 ) return GRESKA( playerid, "Morate biti level 3+ da bi mogli dropati oruzje." );
    if( GetPlayerState( playerid ) != PLAYER_STATE_ONFOOT ) return GRESKA( playerid, "Morate biti na nogama da bi bacili oruzje!" );
	if( DropedGun[ playerid ] != 0 ) return GRESKA( playerid, "Morate sacekati jos %d sekundi da bi ponovo bacili oruzje.", DropedGun[ playerid ] );
	if( GetFactionType( playerid ) == ORG_TIP_PD ) return GRESKA( playerid, "PD nema potrebe da koristi ovu komandu." );
	if( NaDmEventu[ playerid ] == true ) return GRESKA( playerid, "Ne mozes na DM Zoni." );
	if( WARPInfo[ playerid ][ WARIgrac ] != -1 ) return GRESKA( playerid, "Ne mozes dok si u WARu." );

	new GunID = GetWeapon( playerid );
	new GunAmmo = GetPlayerAmmo( playerid );
	if( GunID > 0 && GunAmmo != 0 ) {
	    if( GetWeapon( playerid ) == GetPlayerWeapon( playerid ) ) {
			new f = -1;
            for( new a = 0; a < MAX_GOBJ; a++ ) {
                if( dGunData[ a ][ ObjPos ][ 0 ] == 0.0 ) {
                    f = a;
                    break;
                }
            }
            if( f == -1 ) return GRESKA( playerid, "Trenutno ne mozes baciti oruzje na pod." );
			RemovePlayerWeapon( playerid, GunID );

			dGunData[ f ][ ObjData ][ 0 ] = GunID;
			dGunData[ f ][ ObjData ][ 1 ] = GunAmmo;

			GetPlayerPos( playerid, dGunData[ f ][ ObjPos ][ 0 ], dGunData[ f ][ ObjPos ][ 1 ], dGunData[ f ][ ObjPos ][ 2 ] );
            dGunData[ f ][ gObjID ] = CreateDynamicObject( WeaponInfos[ GunID ][ wModel ], dGunData[ f ][ ObjPos ][ 0 ], dGunData[ f ][ ObjPos ][ 1 ], dGunData[ f ][ ObjPos ][ 2 ]-1, 93.7, 120.0, 120.0 );
            DropedGun[ playerid ] = 30;
			SendClientMessageEx( playerid, -1, "Bacio si oruzje "col_server"%s.", WeaponInfos[ dGunData[ f ][ ObjData ][ 0 ] ][ wName ] );
		}
    }
	return true;
}
/pickupgun
Код:
CMD:uzmioruzje( playerid, params[] ) {

    if( GetPlayerState(playerid) != PLAYER_STATE_ONFOOT ) return GRESKA( playerid, "Moras biti na nogama da bi bacio oruzje!");
    if( NaDmEventu[ playerid ] == true ) return GRESKA( playerid, "Ne mozes na DM Zoni." );
	if( WARPInfo[ playerid ][ WARIgrac ] != -1 ) return GRESKA( playerid, "Ne mozes dok si u WARU." );

	new f = -1;
	for( new a = 0; a < MAX_GOBJ; a++ ) {
		if( IsPlayerInRangeOfPoint( playerid, 5.0, dGunData[ a ][ ObjPos ][ 0] , dGunData[ a ][ ObjPos ][ 1 ], dGunData[ a ][ ObjPos ][ 2 ] ) ) {
			f = a;
		    break;
		}
	}
	if( f == -1 ) return GRESKA( playerid, "Nemas oruzje u blizini." );
	DestroyDynamicObject( dGunData[ f ][ gObjID ] );

	SendClientMessageEx( playerid, -1, "Pokupio si oruzje "col_server"%s.", WeaponInfos[ dGunData[ f ][ ObjData ][ 0 ] ][ wName ] );

	GiveWeaponToPlayer( playerid, dGunData[ f ][ ObjData ][ 0 ], dGunData[ f ][ ObjData ][ 1 ] );
	dGunData[ f ][ ObjPos ][ 0 ] = 0.0;
	dGunData[ f ][ ObjPos ][ 1 ] = 0.0;
	dGunData[ f ][ ObjPos ][ 2 ] = 0.0;
	dGunData[ f ][ gObjID ] = -1;
	dGunData[ f ][ ObjData ][ 0 ] = 0;
	dGunData[ f ][ ObjData ][ 1 ] = 0;
	return true;
}
Код:
stock CreateDroppedGun( GunID, GunAmmo, Float:gPosX, Float:gPosY, Float:gPosZ ) {
    for( new a = 0; a < MAX_GOBJ; a++ ) {
        if( dGunData[ a ][ ObjPos ][ 0 ] == 0.0 ) {
            dGunData[ a ][ ObjData ][ 0 ] = GunID;
			dGunData[ a ][ ObjData ][ 1 ] = GunAmmo;
			dGunData[ a ][ ObjPos ][ 0 ] = gPosX;
			dGunData[ a ][ ObjPos ][ 1 ] = gPosY;
			dGunData[ a ][ ObjPos ][ 2 ] = gPosZ;
			dGunData[ a ][ gObjID ] = CreateDynamicObject( WeaponInfos[ GunID ][ wModel ], dGunData[ a ][ ObjPos ][ 0 ], dGunData[ a ][ ObjPos ][ 1 ], dGunData[ a ][ ObjPos ][ 2 ]-1, 93.7, 120.0, random(360) );
            return 1;
		}
    }
	return 1;
}
Reply
#7

well u have a drop system
PHP код:
stock CreateDroppedGunGunIDGunAmmoFloat:gPosXFloat:gPosYFloat:gPosZ ) {
    for( new 
0MAX_GOBJa++ ) {
        if( 
dGunData][ ObjPos ][ ] == 0.0 ) {
            
dGunData][ ObjData ][ ] = GunID;
            
dGunData][ ObjData ][ ] = GunAmmo;
            
dGunData][ ObjPos ][ ] = gPosX;
            
dGunData][ ObjPos ][ ] = gPosY;
            
dGunData][ ObjPos ][ ] = gPosZ;
            
dGunData][ gObjID ] = CreateDynamicObjectWeaponInfosGunID ][ wModel ], dGunData][ ObjPos ][ ], dGunData][ ObjPos ][ ], dGunData][ ObjPos ][ ]-193.7120.0random(360) );
            return 
1;
        }
    }
    return 
1;

now you have to add a dropped guns around a map, for example:
CreateDroppedGun(31, 50, 1284.411, 512.91, 41.11); // creates a M4 with 50 ammo at this location.
CreateDroppedGun(30, 60, 628.451, 122.55, 11.56); // creates an AK with 60 ammo at this location.
Reply
#8

Thanks....
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)