[+]: Vehicle Speed = + score not work. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [+]: Vehicle Speed = + score not work. (
/showthread.php?tid=605617)
[+]: Vehicle Speed = + score not work. -
ProRakNet - 22.04.2016
Problem solved.
Re: [+]: Vehicle Speed = + score not work. -
colonel-top - 22.04.2016
Like this ? Try it
PHP код:
#define PRESSING(%0,%1) \
(%0 & (%1))
// Top of Your Script
new final_speed[MAX_PLAYERS]; // Top of Your Script too
stock GetPlayerSpeed(playerid)
{
new Float:x,Float:y,Float:z,Float:speed;
GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
speed = floatsqroot(((x*x)+(y*y))+(z*z))*100;
final_speed[playerid = floatround(speed,floatround_round);
return final_speed[playerid];
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInAnyVehicle)
{
if (PRESSING( KEY_SPRINT ))
{
if(final_speed[playerid] > 0)
{
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
}
}
}
return 1;
}
Re: [+]: Vehicle Speed = + score not work. -
ProRakNet - 22.04.2016
Quote:
Originally Posted by colonel-top
Like this ? Try it
PHP код:
#define PRESSING(%0,%1) \
(%0 & (%1))
// Top of Your Script
new final_speed[MAX_PLAYERS]; // Top of Your Script too
stock GetPlayerSpeed(playerid)
{
new Float:x,Float:y,Float:z,Float:speed;
GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
speed = floatsqroot(((x*x)+(y*y))+(z*z))*100;
final_speed[playerid = floatround(speed,floatround_round);
return final_speed[playerid];
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInAnyVehicle)
{
if (PRESSING( KEY_SPRINT ))
{
if(final_speed[playerid] > 0)
{
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
}
}
}
return 1;
}
|
unfortunately, it did not work. detecting the speed vehicle (it reaches a certain speed of) contact i can not integrate score. :/
Re: [+]: Vehicle Speed = + score not work. -
colonel-top - 22.04.2016
EDIT :
PHP код:
#define PRESSING(%0,%1) \
(%0 & (%1))
// Top of Your Script
new final_speed[MAX_PLAYERS]; // Top of Your Script too
stock GetPlayerSpeed(playerid)
{
new Float:x,Float:y,Float:z,Float:speed;
GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
speed = floatsqroot(((x*x)+(y*y))+(z*z))*100;
final_speed[playerid = floatround(speed,floatround_round);
return final_speed[playerid];
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInAnyVehicle)
{
if (PRESSING( KEY_SPRINT ))
{
if(final_speed[playerid] > ur_speed_value)
{
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
}
}
}
return 1;
}
and give us error if have
PS. // I do not understood and confusing little bit :P
Re: [+]: Vehicle Speed = + score not work. -
ProRakNet - 22.04.2016
This did code not work, problem is NOT solved.
Re: [+]: Vehicle Speed = + score not work. -
ProRakNet - 22.04.2016
Quote:
Originally Posted by colonel-top
EDIT :
PHP код:
#define PRESSING(%0,%1) \
(%0 & (%1))
// Top of Your Script
new final_speed[MAX_PLAYERS]; // Top of Your Script too
stock GetPlayerSpeed(playerid)
{
new Float:x,Float:y,Float:z,Float:speed;
GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
speed = floatsqroot(((x*x)+(y*y))+(z*z))*100;
final_speed[playerid = floatround(speed,floatround_round);
return final_speed[playerid];
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInAnyVehicle)
{
if (PRESSING( KEY_SPRINT ))
{
if(final_speed[playerid] > ur_speed_value)
{
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
}
}
}
return 1;
}
and give us error if have
PS. // I do not understood and confusing little bit :P
|
ur_speed_value not introduced ?
Re: [+]: Vehicle Speed = + score not work. -
ProRakNet - 23.04.2016
it worked.
https://sampforum.blast.hk/showthread.php?tid=446853