SA-MP Forums Archive
driveby problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: driveby problem (/showthread.php?tid=284314)



driveby problem - rinori - 18.09.2011

how to make only MP5 able to drive by and disable other guns like deagle, spas12, m4, sniper etc.

I want to make MP5 only available to DB.


Re: driveby problem - park4bmx - 18.09.2011

you can do a check with what weapon the player enters into the vehicle
like under
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(GetPlayerWeapon(playerid) == 29)
    {
    //The players Enters the vehicle with MP5
    }else{
    /*You got 2 options [1] to ResetThePlayer Weapons
    //[2] to givehim wep id (0) witch will se the player holding no weapon
    Option [1]*/

    ResetPlayerWeapons(playerid);
    //Option[2]
    GivePlayerWeapon(playerid, 0, 1);
    }
    return 1;
}
Just choose one option and remove the other one


Re: driveby problem - Issam - 18.09.2011

dp a check and if any other guns then MP5 were on the hand of the guy seating as a passanger,Auto scroll to "Unarmed" which means "hand"


Re: driveby problem - Fat - 18.09.2011

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)// OnPlayerEnterVehicle callback, gets called when a player enters a vehicle.
{
    if(GetPlayerWeapon(playerid) == 29)// If player has MP5
    {
        return 1;// Returns value ( nothing. )
    }
    else// What happens if he doesn't have a MP5
    {
        SendClientMessage(playerid, 0xAA3333AA, " You canno't drive-by with a desert eagle !");// Sending a message
        GivePlayerWeapon(playerid, 0, 1); // Giving him fist, so he won't be able to use it.
        return 1;// Returning value for SendClientMessage
    }
    return 1; // Returning value, a must have.
}



Re: driveby problem - rinori - 18.09.2011

tyy worked


Re: driveby problem - Fat - 18.09.2011

No problem.