Код:
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;
}