Capture Zones Basic needs more.
#5

i want to mention that you can use the pickups (inclusive any desired amount of time) to use for capturing zones. iam in a hurry, so there will be some bugs:
Code:
OPPU()
{
	If(GetPVarInt(playerid,"StayingInPickupAlreadySinceMS")==0 || GetTickCount()-GetPVarInt(playerid,"StayingInPickupAlreadySinceMS")>20000)//if not set (or deleted from last capture) then set the pvar to the actual servertime
	{
		SetPVarInt(playerid,"StayingInPickupAlreadySinceMS",GetTickCount());
		return 1;
	}
	else//its >0, so the player already touched the pickup. time to calculate the difference:
	{
		SetPVarInt(playerid,"StayingInPickupAlreadyHowLongMS",GetTickCount()-GetPVarInt(playerid,"StayingInPickupAlreadySinceMS"));
		if(GetPVarInt(playerid,"StayingInPickupAlreadyHowLongMS")>20000)
		{
			//zone captured. DONT forget to erase the pvars aswell
			DeletePVar(playerid,"StayingInPickupAlreadySinceMS");
			DeletePVar(playerid,"StayingInPickupAlreadyHowLongMS");
		}
		else
		{
			//capture failed, coz the player is not touching the pickups anymore
			DeletePVar(playerid,"StayingInPickupAlreadySinceMS");
			DeletePVar(playerid,"StayingInPickupAlreadyHowLongMS");
		}
	}
}
the precision is not that precise like a timer, but who gives a fuck for max. 1 second tolerance? i dont
the idea with =="leaving pickup" can be reversed to !="still touching pickup". plus: w/o any need for yet 1 more timer... sry if theres a concept bug, give it a try
if you leave the pickup, you wont get any message unless you capture the zone. thats the downside, and you need to add a check if the "old" stored time is >20000 ms away (left pickups earlier), so you need to initialize it again >-<
Reply


Messages In This Thread
Capture Zones Basic needs more. - by Admigo - 20.08.2011, 14:35
Re: Capture Zones Basic needs more. - by Lorenc_ - 20.08.2011, 14:58
Re: Capture Zones Basic needs more. - by Admigo - 20.08.2011, 15:11
Re: Capture Zones Basic needs more. - by Admigo - 20.08.2011, 15:42
Re: Capture Zones Basic needs more. - by Babul - 20.08.2011, 16:17
Re: Capture Zones Basic needs more. - by Pinguinn - 20.08.2011, 16:52
Re: Capture Zones Basic needs more. - by Admigo - 20.08.2011, 20:27
Re: Capture Zones Basic needs more. - by FearLe$$ - 29.06.2012, 05:09

Forum Jump:


Users browsing this thread: 2 Guest(s)