FANDOM


Kako koristiti Velocity Funkcije Edit

Ova funkcija je dodata na SA-MP 0.3a verziji i nece raditi na predhodnim.


Kreirati skriptu da skače 10ft (3m) u vozilu ili voziti brzinom svetlosti bez hakovanja je lako sa SetPlayerVelocity(); i OnPlayerKeyStateChange()

Prvo, hajde da počnemo dodavati definicije i tajmer.

#include <a_samp>
 
#define PRITISNUT(%0) \
	(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
 
new Odkucaj[MAX_PLAYERS];
 
public OnPlayerUpdate(playerid)
{
	Odkucaj[playerid]++;
	if(Odkucaj[playerid] != 3) return 1;
	Odkucaj[playerid] = 0;
 	new Keys,up,down;
       	GetPlayerKeys(playerid,Keys,up,down);
	new Float:x,Float:y,Float:z;
	if(Keys &= 1024)
	{
   		if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
		{
 
			GetPlayerVelocity(playerid,x,y,z);
			SetPlayerVelocity(playerid,x*1.2,y*1.2,z*1.2);
		}
	}
 	else if(Keys &= 4)
      	{
        	if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
		{
			GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
			SetVehicleVelocity(GetPlayerVehicleID(playerid),x*1.2,y*1.2,z*1.2);
		}
	}
	return 1;
}

Ovaj sledeći deo će vam pokazadi kako da skočite 10ft(3m) u vazduh sa vozilom.

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if (PRITISNUT(KEY_HANDBRAKE)) // Change KEY_HANDBRAKE to your choice of PlayerKeys
	{
        new Float:x, Float:y, Float:z;
	GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
	SetVehicleVelocity(GetPlayerVehicleID(playerid) ,x ,y ,z+0.3);
	}
	return 1;
}

Sve što treba da uradite jeste da držite levi ALT u vozilu kako bi ste ga ubrzali. Pritisnite handbrake(Space) kako bi ste skakali sa vozilom.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.