Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Drone System by GlorifiedPig");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_BLUE 0x0000BBAA
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_ORANGE 0xFF9900AA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_MAGENTA 0xFF00FFFF
- #define COLOR_BLACK 0x000000AA
- #define COLOR_BROWN 0XA52A2AAA
- #define COLOR_GOLD 0xB8860BAA
- #define COLOR_GREENYELLOW 0xADFF2FAA
- #define COLOR_LIMEGREEN 0x32CD32AA
- #define COLOR_MIDNIGHTBLUE 0X191970AA
- #define COLOR_PINK 0xFFC0CBAA
- new Drones[MAX_PLAYERS];
- public OnPlayerConnect(playerid)
- {
- SetPVarInt( playerid, "DroneSpawned", 0 );
- SetPVarFloat( playerid, "OldPosX", 0 );
- SetPVarFloat( playerid, "OldPosY", 0 );
- SetPVarFloat( playerid, "OldPosZ", 0 );
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- DestroyVehicle( Drones[playerid] );
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if( GetPVarInt( playerid, "DroneSpawned" ) == 1 ) {
- SetPVarInt( playerid, "DroneSpawned", 0 );
- DestroyVehicle( Drones[playerid] );
- SendClientMessage( playerid, COLOR_GREENYELLOW, "Your drone was automatically shut down as you have died." );
- }
- return 1;
- }
- CMD:drone(playerid, params[])
- {
- new str[128];
- if( sscanf( params, "s", str ) ) return SendClientMessage( playerid, COLOR_RED, "USAGE: /drone [spawn/detonate/remove]" );
- if( strcmp( str, "spawn" ) == 0 ) {
- if( GetPVarInt( playerid, "DroneSpawned" ) == 0 ) {
- new Float:Health;
- GetPlayerHealth( playerid, Health );
- if(Health != 0) {
- new Float:PosX, Float:PosY, Float:PosZ;
- GetPlayerPos( playerid, PosX, PosY, PosZ );
- SetPVarFloat( playerid, "OldPosX", PosX );
- SetPVarFloat( playerid, "OldPosY", PosY );
- SetPVarFloat( playerid, "OldPosZ", PosZ );
- SetPVarInt( playerid, "DroneSpawned", 1 );
- SendClientMessage( playerid, COLOR_GREEN, "You have successfully spawned a drone." );
- Drones[playerid] = CreateVehicle( 465, PosX, PosY, PosZ + 20, 0, 0, 0, 0, -1 );
- PutPlayerInVehicle( playerid, Drones[playerid], 0 );
- }
- } else {
- SendClientMessage( playerid, COLOR_RED, "You already have a drone spawned in!" );
- }
- } else {
- if( strcmp( str, "detonate" ) == 0 ) {
- if( GetPVarInt( playerid, "DroneSpawned" ) == 1 ) {
- new Float:PosX, Float:PosY, Float:PosZ;
- GetVehiclePos( Drones[playerid], PosX, PosY, PosZ );
- SetPVarInt( playerid, "DroneSpawned", 0 );
- SendClientMessage( playerid, COLOR_GREEN, "Drone successfully detonated." );
- DestroyVehicle( Drones[playerid] );
- CreateExplosion( PosX, PosY, PosZ, 7, 25 );
- SetPlayerPos(playerid, GetPVarFloat( playerid, "OldPosX" ), GetPVarFloat( playerid, "OldPosY" ), GetPVarFloat( playerid, "OldPosZ" ));
- } else {
- SendClientMessage( playerid, COLOR_RED, "You need to have a drone spawned in!" );
- }
- } else {
- if( strcmp( str, "remove" ) == 0 ) {
- if( GetPVarInt( playerid, "DroneSpawned" ) == 1 ) {
- SetPVarInt( playerid, "DroneSpawned", 0 );
- SendClientMessage( playerid, COLOR_GREEN, "You have shut your drone down." );
- DestroyVehicle( Drones[playerid] );
- SetPlayerPos(playerid, GetPVarFloat( playerid, "OldPosX" ), GetPVarFloat( playerid, "OldPosY" ), GetPVarFloat( playerid, "OldPosZ" ));
- } else {
- SendClientMessage( playerid, COLOR_RED, "You need to have a drone spawned in!" );
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- if( vehicleid == Drones[playerid] ) {
- SendClientMessage( playerid, COLOR_RED, "You can't exit the drone! Use /drone remove or /drone detonate." );
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment