How to get vehicle speed?
#1

Hey everyone, here i ask you questions.

Quote:

1. How to get vehicle speed?

Quote:

2.
Quote:

pInfo[playerid][newbie] = true;
new file[128], name[128];
GetPlayerName(playerid,name,12;
format(file,128,"players/%s.ini",name);
dini_Create(file);
HowMuchPlayers++;
HowMuchPlayers = pInfo[playerid][id];
dini_Set(file,"slaptazodis",inputtext);
dini_IntSet(file, "id", pInfo[playerid][id]);
Save( playerid );
SendClientMessage(playerid,0xFFFFFFFF,"{eb2142}• Registered.");
new failas[26];
format(failas,26,"serverinformation.ini");
dini_IntSet(failas,"HowMuchPlayers",HowMuchPlayers );

Now when you register a new player, then the variable HowMuchPlayers contribute +1 and under it I want to set the new user id and Set Player Virtual World under id.

Reply
#2

GetVehicleVelocity
Reply
#3

A small script I made.

pawn Код:
#include <a_samp>

stock GetPlayerSpeed(playerid)
{
    new Float:x,Float:y,Float:z,Float:speed,final_speed;
    GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
    speed = floatsqroot(((x*x)+(y*y))+(z*z))*100;
    final_speed = floatround(speed,floatround_round);
    return final_speed;
}
An example for getting speed:
PHP код:
if(!strcmp(cmdtext,"/speed",true,6))
{
    new 
string[124];
    
format(string,sizeof(string),"Speed:%d MPH",GetPlayerSpeed(playerid));
    
SendClientMessage(playerid,-1,string);
    return 
1;

Reply
#4

pawn Код:
#include <a_samp>

stock GetPlayerSpeed(playerid)
{
    new Float:x, Float:y, Float:z;
    new Float:speed, Float:final_speed;
    GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
    speed = floatsqroot(((x*x)+(y*y))+(z*z))*100;
    final_speed = floatround(speed,floatround_round);
    return final_speed;
}
Reply
#5

Next Question is:

Quote:

pInfo[playerid][newbie] = true;
new file[128], name[128];
GetPlayerName(playerid,name,12;
format(file,128,"players/%s.ini",name);
dini_Create(file);
HowMuchPlayers++;
HowMuchPlayers = pInfo[playerid][id];
dini_Set(file,"slaptazodis",inputtext);
dini_IntSet(file, "id", pInfo[playerid][id]);
Save( playerid );
SendClientMessage(playerid,0xFFFFFFFF,"{eb2142}• Registered.");
new failas[26];
format(failas,26,"serverinformation.ini");
dini_IntSet(failas,"HowMuchPlayers",HowMuchPlayers );

Now when you register a new player, then the variable HowMuchPlayers contribute +1 and under it I want to set the new user id and Set Player Virtual World under id.
Reply
#6

Add this HowMuchPlayers++ in your register system
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)