Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # #
- # FS Balloon v1.0 by Flovv #
- # #
- # Simple Filterscript for flying #
- # the Hot Air Ballon with a jetpack #
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
- #include <a_samp>
- //SETTINGS
- new bool:allow_jetpack = false; //set true if jetpacks are allowed on your server
- new Float:fs_balloon_kor[][3] =
- {
- // Balloon Positions, (X, Y, Z)
- {-2318.278076,-1625.151977,483.406787}, //balloon 1 mt. chilliad
- {-1220.447998,9.320171,13.901531}, //balloon 2 sf airport
- {1920.374145,-2310.464355,13.246875}, //balloon 3 ls airport
- {1339.667236, 1309.602172, 10.520312} //balloon 4 lv airport
- };
- //VARS
- new fs_balloon_set[sizeof(fs_balloon_kor)][4];
- //[0]->balloon id; [1]->fire 1 id; [2]->fire 2 id; [3]->pickup id
- new fs_balloon_pl[MAX_PLAYERS][2];
- //[playerid][0]->status (0)is set so player can't pickup the jetpack again, (1)flying a balloon, (2)not flying a balloon
- //[playerid][1]->balloon number the player is in
- //functions
- forward pinbal(playerid);
- SpawnBalloon(fs_balloonID)
- {
- fs_balloon_set[fs_balloonID][0] = CreateObject(((random(7))+19332),fs_balloon_kor[fs_balloonID][0],fs_balloon_kor[fs_balloonID][1],fs_balloon_kor[fs_balloonID][2],0.0,0.0,0.0,300.0); //balloon
- fs_balloon_set[fs_balloonID][1] = CreateObject(18692,0.0,0.0,0.0,0.0,0.0,0.0,300.0); //fire 1
- fs_balloon_set[fs_balloonID][2] = CreateObject(18692,0.0,0.0,0.0,0.0,0.0,0.0,300.0); //fire 2
- AttachObjectToObject(fs_balloon_set[fs_balloonID][1], fs_balloon_set[fs_balloonID][0], 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 1);
- AttachObjectToObject(fs_balloon_set[fs_balloonID][2], fs_balloon_set[fs_balloonID][0], 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 1);
- fs_balloon_set[fs_balloonID][3] = CreatePickup(1559, 1, fs_balloon_kor[fs_balloonID][0], fs_balloon_kor[fs_balloonID][1], fs_balloon_kor[fs_balloonID][2] + 1, 0);
- return 1;
- }
- DestroyBalloon(fs_balloonID)
- {
- DestroyObject(fs_balloon_set[fs_balloonID][0]);
- DestroyObject(fs_balloon_set[fs_balloonID][1]);
- DestroyObject(fs_balloon_set[fs_balloonID][2]);
- return 1;
- }
- public pinbal(playerid) //set the player in balloon value via timer, otherwise it's gettin buggy with OnPlayerUpdate
- {
- fs_balloon_pl[playerid][0] = 1;
- return 1;
- }
- // Callbacks
- public OnFilterScriptInit()
- {
- new balcount = 0;
- for(new i = 0; i < sizeof(fs_balloon_kor); i++)
- {
- SpawnBalloon(i);
- balcount++;
- }
- printf("++++++++++++++++++++++++");
- printf("+ fs_balloon +");
- printf("+ Hot Air Balloon v1.0 +");
- printf("+ by Flovv +");
- printf("++++++++++++++++++++++++\n");
- printf(" Spawned %d Hot Air Balloons",balcount);
- return 1;
- }
- public OnFilterScriptExit()
- {
- for(new i = 0; i < sizeof(fs_balloon_kor); i++)
- {
- DestroyBalloon(i);
- }
- return 1;
- }
- //player enters balloon
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- if(fs_balloon_pl[playerid][0] == 0)
- {
- for(new i = 0; i < sizeof(fs_balloon_kor); i++)
- {
- if(fs_balloon_set[i][3] == pickupid)
- {
- fs_balloon_pl[playerid][0] = 2;
- AttachObjectToPlayer(fs_balloon_set[i][0],playerid,0.0,0.0,-1.0,0.0,0.0,0.0); //attach balloon to player
- SetPlayerSpecialAction(playerid, 2);
- DestroyPickup(pickupid);
- SetTimerEx("pinbal", 200, false, "i", playerid);
- fs_balloon_pl[playerid][1] = i;
- i = sizeof(fs_balloon_kor);
- }
- }
- }
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- //player exits balloon
- if(GetPlayerSpecialAction(playerid) != 2 && fs_balloon_pl[playerid][0] == 1)
- {
- DestroyBalloon(fs_balloon_pl[playerid][1]);
- SpawnBalloon(fs_balloon_pl[playerid][1]);
- fs_balloon_pl[playerid][0] = 0;
- }
- //player won't be able to pick up the spawned jetpack
- if(GetPlayerSpecialAction(playerid) == 2 && fs_balloon_pl[playerid][0] == 0)
- {
- if(!allow_jetpack && IsPlayerAdmin(playerid) == 0)
- {
- SetPlayerSpecialAction(playerid, 0);
- SendClientMessage(playerid, 0xFF0000FF, "SERVER: Jetpacks aren't allowed!");
- }
- }
- return 1;
- }
- //fix the balloon not showing problem?
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- if(fs_balloon_pl[playerid][0] == 1)
- {
- AttachObjectToPlayer(fs_balloon_set[fs_balloon_pl[playerid][1]][0],playerid,0.0,0.0,-1.0,0.0,0.0,0.0);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement