28.04.2015, 20:36
INCLUDE:
Quote:
forward DropPlayerWeapons(playerid); forward DeletePickup(pickupid); forward GetWeaponModel(weaponid); forward PickupSecondTimer(); forward Pickup_OnPlayerPickup(playerid,pickupid); new PickupLimit=6; new moneypickup[400]; new moneypickup_wanted[400]; new bool:droppedpickup[400]; enum ppdata { modelid, ptype } new pickupdata[400][ppdata]; new pickuptime[400]; stock AddStaticPickup2(model,pickuptype,Float:X,Float:Y, Float:Z) { new pickupid = AddStaticPickup(model,pickuptype,X,Y,Z); pickupdata[pickupid][modelid] = model; pickupdata[pickupid][ptype] = pickuptype; return pickupid; } stock CreatePickup2(model,pickuptype,Float:X,Float:Y,Flo at:Z) { new pickupid = CreatePickup(model,pickuptype,X,Y,Z); pickupdata[pickupid][modelid] = model; pickupdata[pickupid][ptype] = pickuptype; return pickupid; } stock CreateMoneyPickup(amount,wanted,Float,Float:y,Fl oat:z) { new pickupid = CreatePickup(1550,2,x,y,z); moneypickup[pickupid] = amount; moneypickup_wanted[pickupid] = wanted; pickupdata[pickupid][modelid] = 1212; pickupdata[pickupid][ptype] = 2; pickuptime[pickupid]=60; return pickupid; } stock GetPickupModel(pickupid) { return pickupdata[pickupid][modelid]; } stock GetPickupType(pickupid) { return pickupdata[pickupid][ptype]; } stock SetPickupToDestroy(pickupid,cas) { pickuptime[pickupid] = cas+1; } public DropPlayerWeapons(playerid) { new playerweapons[13][2]; new Float,Float:y,Float:z; GetPlayerPos(playerid, x, y, z); for(new i=0;i<13;i++){ GetPlayerWeaponData(playerid, i, playerweapons[i][0], playerweapons[i][1]); new model=GetWeaponModel(playerweapons[i][0]); new times=floatround(playerweapons[i][1]/10.0001); new string[20]; format(string, sizeof(string), "%d", times); times=strval(string); new Float:X=x+(random(3)-random(3)); new Float:Y=y+(random(3)-random(3)); if(playerweapons[i][1]!=0) { if(times>PickupLimit) times=PickupLimit; for(new a=0;a<times;a++) { if(model!=-1) { new pickupid=CreatePickup2(model, 3, X, Y, z); droppedpickup[pickupid] = true; //SendClientMessage(playerid,COLOR_GREEN2,"create"); //SetTimerEx("DeletePickup", DeleteTime*1000, false, "d", pickupid); SetPickupToDestroy(pickupid,30); } } } } if(GetPlayerMoney(playerid) > 0) { new Float:X=x+(random(3)-random(3)); new Float:Y=y+(random(3)-random(3)); new pickupid=CreatePickup2(1212, 3, X, Y, z); moneypickup[pickupid] = GetPlayerMoney(playerid); droppedpickup[pickupid] = true; SetPickupToDestroy(pickupid,10); } ResetPlayerWeapons(playerid); ResetPlayerMoney(playerid); return 1; } public DeletePickup(pickupid) { moneypickup[pickupid] = 0; droppedpickup[pickupid] = false; DestroyPickup(pickupid); return 1; } stock GetWeaponidFromPickup(model) { for(new i=1;i<46;i++) { if(GetWeaponModel(i)==model)return i; } return 1; } public GetWeaponModel(weaponid) { new model; switch(weaponid) { case 1: model=331; case 2: model=333; case 3: model=334; case 4: model=335; case 5: model=336; case 6: model=337; case 7: model=338; case 8: model=339; case 9: model=341; case 10: model=321; case 11: model=322; case 12: model=323; case 13: model=324; case 14: model=325; case 15: model=326; case 16: model=342; case 17: model=343; case 18: model=344; case 22: model=346; case 23: model=347; case 24: model=348; case 25: model=349; case 26: model=350; case 27: model=351; case 28: model=352; case 29: model=353; case 30: model=355; case 31: model=356; case 32: model=372; case 33: model=357; case 34: model=358; case 35: model=359; case 36: model=360; case 37: model=361; case 38: model=362; case 39: model=363; case 41: model=365; case 42: model=366; case 46: model=371; } if(model<300) return -1; return model; } public PickupSecondTimer() { for (new i=0;i<400;i++) { if(pickuptime[i] > 1) { pickuptime[i] -= 1; } if(pickuptime[i] == 1) { pickuptime[i] = 0; DeletePickup(i); } } } public Pickup_OnPlayerPickup(playerid,pickupid) { /* if(GetWeaponIdFromModel(GetPickupModel(pickupid)) != -1) { new wpnid = GetWeaponIdFromModel(GetPickupModel(pickupid)); //PlayerGuns[playerid][wpnid] = 1; } */ if(moneypickup[pickupid] > 0) { if(moneypickup_wanted[pickupid]>0) { if(GetPlayerJob(playerid)!=12)//#define JOB_SBS 12 { SetPlayerWantedLevel(playerid,GetPlayerWantedLevel (playerid)+moneypickup_wanted[pickupid]); GivePlayerMoney(playerid,moneypickup[pickupid]); moneypickup_wanted[pickupid]=0; DeletePickup(pickupid); }else{ moneypickup_wanted[pickupid]=0; DeletePickup(pickupid); GameTextForPlayer(playerid,"~g~Zaistili ste vypadnute peniaze! Dobra praca!",2000,6); } }else{ GivePlayerMoney(playerid,moneypickup[pickupid]); moneypickup[pickupid]=0; DeletePickup(pickupid); } } if(droppedpickup[pickupid] == true) { droppedpickup[pickupid] = false; DestroyPickup(pickupid); new weaponid = GetWeaponidFromPickup(pickupdata[pickupid][modelid]); new ac_hrac[playerid][ac_guns][weaponid]+=1000; ac_hrac[playerid][ac_guns][weaponid]+=1000; } } |