07.08.2012, 19:59
Hello everyone, i have a problem with my Care package FS, when you spawn more than 1 box you cant pick the ammo from the care package
Example:
This is my code:
![Sad](images/smilies/sad.gif)
Quote:
if you spawn 3 boxes you will only be able to pick one |
Код:
new Float:x,Float:y,Float:z; new Float:q,Float:w,Float:e; new Float:carex,Float:carey,Float:carez; new planr; new smok; new care1; new diamond; public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/testing", cmdtext, true, 10) == 0) { if(!IsValidObject(care1)) { GetPlayerPos(playerid,x,y,z); planr = CreateObject(1681, x - 45.66, y - 150.50, z + 80.30, 0.00, 0.00, -24.24); GetObjectPos(planr,q,w,e); MoveObject(planr, q + 158.5427, w + 332.2500, e + 0.0000,70.5, 0.00, 0.00, -24.24); smok = CreateObject(18728, x, y, z-2.60, 0.00, 0.00, 0.00); GetObjectPos(smok,q,w,e); SetTimer("carep1",2000,false); SetTimer("carepkill",30000,false); } else { GameTextForPlayer(playerid, "Theres already a Care Package",2000,3); } return 1; } return 0; } forward carep1(); public carep1() { care1 = CreateObject(2977, x + 0.00, y + 0.00, z + 70.47, 0.00, 0.00, 0.00); MoveObject(care1,q,w,e + 1.4227,70.5,0,0,0); GetObjectPos(care1,carex,carey,carez); } forward carepkill(); public carepkill() { DestroyObject(care1); DestroyObject(diamond); } public OnObjectMoved(objectid) { if(objectid == planr) { DestroyObject(planr); } if(objectid == care1) { GetObjectPos(care1,carex,carey,carez); diamond = CreateObject(1559, carex - 0.03, carey - 0.06, carez + 4.03, 0.00, 0.00, 0.00); DestroyObject(smok); } return 1; }
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(newkeys == KEY_YES) { if(IsPlayerInRangeOfPoint(playerid, 4.0, carex,carey,carez)) { new rnd = random(8); if(rnd == 2) { GivePlayerWeapon(playerid, 34,100); DestroyObject(care1); DestroyObject(diamond); } if(rnd == 3) { GivePlayerWeapon(playerid, 31,100); DestroyObject(care1); DestroyObject(diamond); } if(rnd == 7) { GivePlayerWeapon(playerid, 24,100); DestroyObject(care1); DestroyObject(diamond); } } } return 1; }