enum aname
{
SuperPower
}
new Abilitys[MAX_PLAYERS][aname];
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(newkeys & KEY_WALK))
{
if(gettime() - 6 < Abilitys[playerid][SuperPower])return GameTextForPlayer(playerid,"~w~ Power Recharging!",1000,5);
ApplyAnimation(playerid,"ped","Shove_Partial",3.9,0,1,1,1,1,1);
SetPlayerAttachedObject(playerid,0,18683,6);
SetPlayerAttachedObject(playerid,1,18728,6);
SetPlayerAttachedObject(playerid,2,338,6);
Abilitys[playerid][SuperPower] = gettime();
{
for( new i = 0; i < MAX_PLAYERS; i++ )
if(GetDistanceBetweenPlayers(playerid,i) < 6.0)
{
GetPlayerFacingAngle(i,vec[3]); GetPlayerVelocity(i,vec[0],vec[1],vec[2]); SetPlayerVelocity(i,vec[0]+0.3,vec[1]+0.3,vec[2]+0.2);
SetPlayerFacingAngle(i,vec[3]);
}
}
}
public Float:GetDistanceBetweenPlayers(p1,p2)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2)) {
return -1.00;
}
GetPlayerPos(p1,x1,y1,z1);
GetPlayerPos(p2,x2,y2,z2);
return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub?(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
return 1;
}
}
GetPlayerFacingAngle(i,vec[3]); GetPlayerVelocity(i,vec[0],vec[1],vec[2]); SetPlayerVelocity(i,vec[0]+0.3,vec[1]+0.3,vec[2]+0.2);
new vec[4];
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
enum aname
{
SuperPower
}
new Abilitys[MAX_PLAYERS][aname];
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_WALK))
{
if(gettime() - 6 < Abilitys[playerid][SuperPower])return GameTextForPlayer(playerid,"~w~ Power Recharging!",1000,5);
ApplyAnimation(playerid,"ped","Shove_Partial",3.9,0,1,1,1,1,1);
SetPlayerAttachedObject(playerid,0,18683,6);
SetPlayerAttachedObject(playerid,1,18728,6);
SetPlayerAttachedObject(playerid,2,338,6);
Abilitys[playerid][SuperPower] = gettime();
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetDistanceBetweenPlayers(playerid,i) < 6.0)
{
new Float:vec[4];
GetPlayerVelocity(i,vec[0],vec[1],vec[2]); GetPlayerFacingAngle(i,vec[3]);
SetPlayerVelocity(i,vec[0]+0.3,vec[1]+0.3,vec[2]+0.2);
SetPlayerFacingAngle(i,vec[3]);
}
}
}
return 1;
}
public Float:GetDistanceBetweenPlayers(p1,p2)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2)) return -1.00;
GetPlayerPos(p1,x1,y1,z1); GetPlayerPos(p2,x2,y2,z2);
return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub?(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
PHP код:
|
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
enum aname
{
SuperPower
}
new Abilitys[MAX_PLAYERS][aname];
stock Float:GetDistanceBetweenPlayers(p1, p2)
{
if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2)) return -1.00;
new Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2;
GetPlayerPos(p1, x1, y1, z1); GetPlayerPos(p2, x2, y2, z2);
return floatsqroot(floatpower(floatabs(floatsub(x2, x1)), 2) + floatpower(floatabs(floatsub(y2, y1)), 2) + floatpower(floatabs(floatsub(z2, z1)), 2));
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_WALK))
{
if(gettime() - 6 < Abilitys[playerid][SuperPower])return GameTextForPlayer(playerid,"~w~ Power Recharging!",1000,5);
ApplyAnimation(playerid,"ped","Shove_Partial",3.9,0,1,1,1,1,1);
SetPlayerAttachedObject(playerid,0,18683,6);
SetPlayerAttachedObject(playerid,1,18728,6);
SetPlayerAttachedObject(playerid,2,338,6);
Abilitys[playerid][SuperPower] = gettime();
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetDistanceBetweenPlayers(playerid,i) < 6.0)
{
new Float:vec[4];
GetPlayerVelocity(i,vec[0],vec[1],vec[2]); GetPlayerFacingAngle(i,vec[3]);
SetPlayerVelocity(i,vec[0]+0.3,vec[1]+0.3,vec[2]+0.2);
SetPlayerFacingAngle(i,vec[3]);
}
}
}
return 1;
}