Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Use DestroyPickupEx if you want to destroy a pickup!
- //News
- new Float:PickupPos[MAX_PICKUPS][3], Pickups = 0, outsidefront, outsideback, insideback, insidefront;
- //Forward
- forward Check();
- //Stocks
- stock CreatePickupEx(model, type, Float:X, Float:Y, Float:Z, Virtualworld)
- {
- new pickupid = CreatePickup(model, type, Float:X, Float:Y, Float:Z, Virtualworld);
- Pickups++;
- PickupPos[pickupid][0] = X;
- PickupPos[pickupid][1] = Y;
- PickupPos[pickupid][2] = Z;
- return pickupid;
- }
- stock DestroyPickupEx(pickup)
- {
- DestroyPickup(pickup);
- Pickups--;
- for(new i = 0; i < 3; i++) PickupPos[pickupid][i] = 0.0;
- }
- //Publics
- public Check()
- {
- for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
- {
- if(IsPlayerConnected(playerid))
- {
- new bool:pickupcheck = false;
- for(new i = 0; i < Pickups; i++) if(IsPlayerInRangeOfPoint(playerid, 4.0, PickupPos[i][0], PickupPos[i][1], PickupPos[2])) pickupcheck = true;
- if(!pickupcheck) SetPVarInt(playerid, "PickupID", -1);
- }
- }
- }
- Public OnGameModeInit()
- {
- //Pickups
- outsidefront = CreatePickupEx(1318,23,2131.8494,-1151.0961,24.0855,-1);
- outsideback = CreatePickupEx(1318,23,2124.0605,-1169.6489,24.1428,-1);
- insideback = CreatePickupEx(1318,23,2128.6238,-1165.9609,13.7360,-1);
- insidefront = CreatePickupEx(1318,23,2130.0591, -1155.0420, 13.7360,-1);
- SetTimer("Check", 500, true);
- }
- public OnPlayerConnect(playerid)
- {
- SetPVarInt(playerid, "PickupID", -1);
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- if(pickupid == outsidefront || pickupid == outsideback || pickupid == insidefront || pickupid == insideback) SetPVarInt(playerid, "PickupID", pickupid);
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if((newkeys & KEY_SECONDARY_ATTACK) &&! (oldkeys & KEY_SECONDARY_ATTACK))
- {
- if(GetPVarInt(playerid, "PickupID") == outsidefront)
- {
- SetPlayerInterior(playerid, 1);
- SetPlayerPos(playerid, 2130.0591, -1155.0420, 13.7360);
- SetPVarInt(playerid, "PickupID", -1);
- }
- else if(GetPVarInt(playerid, "PickupID") == outsideback)
- {
- SetPlayerInterior(playerid, 1);
- SetPlayerPos(playerid, 2128.6238, -1165.9609, 13.7360);
- SetPVarInt(playerid, "PickupID", -1);
- }
- else if(GetPVarInt(playerid, "PickupID") == insidefront)
- {
- SetPlayerInterior(playerid, 0);
- SetPlayerPos(playerid, 2131.8494, -1151.0961, 24.0855);
- SetPVarInt(playerid, "PickupID", -1);
- }
- else if(GetPVarInt(playerid, "PickupID") == insideback)
- {
- SetPlayerInterior(playerid, 0);
- SetPlayerPos(playerid, 2124.0605, -1169.6489, 24.1428);
- SetPVarInt(playerid, "PickupID", -1);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment