drop weapon
#1

Here is the code of drop weapon when a player die
pawn Код:
DropWeapons(playerid){
    new Float: px, Float: py, Float: pz;
    new hour,minute,second;
    new year, month,day;
    gettime(hour, minute, second);
    getdate(year, month, day);
    GetPlayerPos( playerid, px, py, pz );
    new weapon_slots[WEAPON_SLOTS + 1][2];
    new used_weapon_slots;
    for( new i = 0; i < WEAPON_SLOTS; i ++ ){
        GetPlayerWeaponData( playerid, i, weapon_slots[ i ][ 0 ], weapon_slots[ i ][ 1 ]);
        if( i == 0 && weapon_slots[ i ][ 0 ] == 0 ) weapon_slots[ i ][ 1 ] = 0; // no fist...
        if( weapon_slots[ i ][ 1 ] > 0 && weapon_slots[ i ][ 0 ] < sizeof( weapons ) && weapons[ weapon_slots[ i ][ 0 ] ] != -1 ){
            used_weapon_slots ++;}
        else{
            weapon_slots[ i ][ 0 ] = 0;
            weapon_slots[ i ][ 1 ] = 0;}}
    // Create the pickups
    new used_weapon_slots2 = used_weapon_slots;
    for( new i = 0; i < WEAPON_SLOTS; i ++ ){
        if( weapon_slots[ i ][ 1 ] > 0 ){
            new Float:angle = 360.0 - float(used_weapon_slots--) * ( 360.0 / float(used_weapon_slots2) );
            // see... if there's a pickup we create by any chance
            new p = CreateDynamicPickup( weapons[ weapon_slots[ i ][ 0 ] ], PICKUP_TYPE, px + floatsin(angle,degrees) * (used_weapon_slots2/2 + 1.0), py + floatcos(angle,degrees) * (used_weapon_slots2/2 + 1.0), pz );
            if( p == INVALID_PICKUP ){
                new lowest_time;
                new _id;
                for( new j = 0; j < MAX_PICKUPS; j ++ ){
                    if( pickups[ j ][ creation_time ] < lowest_time ){
                        lowest_time = pickups[ j ][ creation_time ];
                        _id = j;}}
                DestroyPickupEx( _id );
                KillTimer( pickups[ _id ][ ptimer ] );
                p = CreateDynamicPickup( weapons[ weapon_slots[ i ][ 0 ] ], PICKUP_TYPE, px + floatsin(angle,degrees) * (used_weapon_slots2/2 + 1.0), py + floatcos(angle,degrees) * (used_weapon_slots2/2 + 1.0), pz );}
            pickups[ p ][ creation_time ] = nmktime(hour,minute,second,day,month,year);
            pickups[ p ][ weapon ] = weapon_slots[ i ][ 0 ];
            pickups[ p ][ dammo ] = weapon_slots[ i ][ 1 ];
            #if MAX_DROP_AMOUNT != -1
            if( pickups[ p ][ dammo ] > MAX_DROP_AMOUNT ){
                pickups[ p ][ dammo ] = MAX_DROP_AMOUNT;}
            #endif
            pickups[ p ][ ptimer ] = SetTimerEx("DestroyPickupEx", MAX_DROP_LIFETIME * 1000, 0, "i", p);}}}
How can i make if a player die then his money should also drop down?
Reply
#2

Add this:
pawn Код:
GivePlayerMoney(playerid,-500);
One honest question:how do you have more than 10 rep points,if you don't even know how to do this?(don't get mad at me)
Reply
#3

Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
Add this:
pawn Код:
GivePlayerMoney(playerid,-500);
One honest question:how do you have more than 10 rep points,if you don't even know how to do this?(don't get mad at me)
Can you please add it in that code? i really dont know
And i dont know which noobs gave me reps
Reply
#4

pawn Код:
DropWeapons(playerid){
    new Float: px, Float: py, Float: pz;
    new hour,minute,second;
    new year, month,day;
    gettime(hour, minute, second);
    getdate(year, month, day);
    GetPlayerPos( playerid, px, py, pz );
    GivePlayerMoney(playerid,-500);
    new weapon_slots[WEAPON_SLOTS + 1][2];
    new used_weapon_slots;
    for( new i = 0; i < WEAPON_SLOTS; i ++ ){
        GetPlayerWeaponData( playerid, i, weapon_slots[ i ][ 0 ], weapon_slots[ i ][ 1 ]);
        if( i == 0 && weapon_slots[ i ][ 0 ] == 0 ) weapon_slots[ i ][ 1 ] = 0; // no fist...
        if( weapon_slots[ i ][ 1 ] > 0 && weapon_slots[ i ][ 0 ] < sizeof( weapons ) && weapons[ weapon_slots[ i ][ 0 ] ] != -1 ){
            used_weapon_slots ++;}
        else{
            weapon_slots[ i ][ 0 ] = 0;
            weapon_slots[ i ][ 1 ] = 0;}}
    // Create the pickups
    new used_weapon_slots2 = used_weapon_slots;
    for( new i = 0; i < WEAPON_SLOTS; i ++ ){
        if( weapon_slots[ i ][ 1 ] > 0 ){
            new Float:angle = 360.0 - float(used_weapon_slots--) * ( 360.0 / float(used_weapon_slots2) );
            // see... if there's a pickup we create by any chance
            new p = CreateDynamicPickup( weapons[ weapon_slots[ i ][ 0 ] ], PICKUP_TYPE, px + floatsin(angle,degrees) * (used_weapon_slots2/2 + 1.0), py + floatcos(angle,degrees) * (used_weapon_slots2/2 + 1.0), pz );
            if( p == INVALID_PICKUP ){
                new lowest_time;
                new _id;
                for( new j = 0; j < MAX_PICKUPS; j ++ ){
                    if( pickups[ j ][ creation_time ] < lowest_time ){
                        lowest_time = pickups[ j ][ creation_time ];
                        _id = j;}}
                DestroyPickupEx( _id );
                KillTimer( pickups[ _id ][ ptimer ] );
                p = CreateDynamicPickup( weapons[ weapon_slots[ i ][ 0 ] ], PICKUP_TYPE, px + floatsin(angle,degrees) * (used_weapon_slots2/2 + 1.0), py + floatcos(angle,degrees) * (used_weapon_slots2/2 + 1.0), pz );}
            pickups[ p ][ creation_time ] = nmktime(hour,minute,second,day,month,year);
            pickups[ p ][ weapon ] = weapon_slots[ i ][ 0 ];
            pickups[ p ][ dammo ] = weapon_slots[ i ][ 1 ];
            #if MAX_DROP_AMOUNT != -1
            if( pickups[ p ][ dammo ] > MAX_DROP_AMOUNT ){
                pickups[ p ][ dammo ] = MAX_DROP_AMOUNT;}
            #endif
            pickups[ p ][ ptimer ] = SetTimerEx("DestroyPickupEx", MAX_DROP_LIFETIME * 1000, 0, "i", p);}}}
There you go,you should loose 500$,but thatis adjustable ofc. :P
Reply
#5

Is it possible to change the money pickup to this ID?
Quote:

1550

Reply
#6

No,it's not,but I don't think that 1550 is a valid PickUp ID,here:
http://weedarr.wikidot.com/pickups/
Reply
#7

ty xD
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)