Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Includes
- #include <a_samp>
- //Einstellungen
- #define MAX_WEAPON_PICKUPS 100
- #define TIMER_INTERVAL 1000
- //Farben
- #define Weis -1
- //Enums
- enum Waffendaten
- {
- PickupID,
- WaffenID,
- WaffenMunni,
- };
- //forwards
- forward createwp(_pid, _t, Float:_1, Float:_2, Float:_3, _w, _wid, _wam);
- //Arrays
- new pWeapons[MAX_WEAPON_PICKUPS][Waffendaten];
- //Callbacks
- public OnFilterScriptInit()
- {
- for(new j, i = sizeof(pWeapons); j<i; j++)
- {
- if(pWeapons[j][PickupID] == 999999)continue;
- pWeapons[j][PickupID] = 999999;
- if(j == sizeof(pWeapons))break;
- }
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- if(!GetPVarInt(playerid, "tod"))
- {
- new wname[50], string[256];
- for(new i;i<MAX_WEAPON_PICKUPS;i++)
- {
- if(pickupid != pWeapons[i][PickupID])continue;
- if(pWeapons[i][WaffenID] == 0)continue;
- if(pWeapons[i][WaffenMunni] == 0)continue;
- GetWeaponName(pWeapons[i][WaffenID], wname, 50);
- format(string, sizeof(string), "Du hast die Waffe '%s' mit jeweils %i Schuss aufgehoben!", wname, pWeapons[i][WaffenMunni]),
- SendClientMessage(playerid, Weis, string);
- GivePlayerWeapon(playerid, pWeapons[i][WaffenID], pWeapons[i][WaffenMunni]);
- pWeapons[i][WaffenID] = 0,pWeapons[i][WaffenMunni] = 0;
- DestroyPickup(pWeapons[i][PickupID]); pWeapons[i][PickupID] = 999999;
- }
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- SetPVarInt(playerid, "tod", 1);
- if(IsValidPickupWeapon(GetPlayerWeapon(playerid)))
- {
- new Float:pPos[3];
- GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
- SetTimerEx("createwp", TIMER_INTERVAL, false, "ddfffddd", GetWeaponPickupID(playerid), 1, pPos[0], pPos[1], pPos[2], GetPlayerVirtualWorld(playerid), GetPlayerWeapon(playerid), GetPlayerAmmo(playerid));
- }
- }
- public OnPlayerSpawn(playerid)
- {
- if(GetPVarInt(playerid, "tod")) SetPVarInt(playerid, "tod", 0);
- }
- public createwp(_pid, _t, Float:_1, Float:_2, Float:_3, _w, _wid, _wam)
- {
- return CreateWeaponPickup(_pid, _t, Float:_1, Float:_2, Float:_3, _w, _wid, _wam);
- }
- stock CreateWeaponPickup(_objectid, _type, Float:_x, Float:_y, Float:_z, _vw, _wid, _wam)
- {
- printf("%d, %d, %f, %f, %f, %d, %d, %d (timer)",_objectid, _type, Float:_x, Float:_y, Float:_z, _vw, _wid, _wam);
- for(new o, x = MAX_WEAPON_PICKUPS; o != x; o++)
- {
- if(pWeapons[o][PickupID] == 999999)
- {
- pWeapons[o][PickupID] = CreatePickup(_objectid, _type, _x, _y, _z, _vw);
- pWeapons[o][WaffenID] = _wid,pWeapons[o][WaffenMunni] = _wam;
- printf("o: %d, id: %d (timer)", o, pWeapons[o][PickupID]);
- return pWeapons[o][PickupID];
- }
- }
- return 999999;
- }
- stock GetWeaponPickupID(playerid)
- {
- new value;
- switch(GetPlayerWeapon(playerid))
- {
- case 24: value = 348; //deagle
- case 25: value = 349; //shotgun
- case 26: value = 350; //doppel shotgun
- }
- return value;
- }
- stock IsValidPickupWeapon(_value)
- {
- switch(_value)
- {
- case 24,25,26:return 1;
- default: return 0;
- }
- return 999999;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement