[Ajuda] Setcarspeed
#1

Код:
new speed = GetPlayerSpeed(playerid, true);
if(speed >= 40) {
setspeedcarro 30
}
Qual a melhor forma de fazer isso? Tentei por setplayerspeed, nгo sei se fiz errado ,mas ficou uma bosta
Reply
#2

Quote:
Originally Posted by warriorfrog
Посмотреть сообщение
Код:
new speed = GetPlayerSpeed(playerid, true);
if(speed >= 40) {
setspeedcarro 30
}
Qual a melhor forma de fazer isso? Tentei por setplayerspeed, nгo sei se fiz errado ,mas ficou uma bosta
vocк esta querendo mudar a velocidade de um carro ?
GetVehicleVelocity
SetVehicleVelocity
Reply
#3

Tem Esse Sistema:
OBS: Nгo Fui Eu Que Fiz.

pawn Код:
new bool:StuntSuperSpeed[MAX_PLAYERS];
pawn Код:
public OnPlayerConnect(playerid)
{
    StuntSuperSpeed[ playerid ] = false;
    return 1;
}
pawn Код:
//Para Fazer Um CMD De Dar Speed Faзa O Comando E Coloque:
StuntSuperSpeed[ playerid ] = true;
//O Veнculo Terб Speed E Jump. Pressione CTRL|ALT
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    //Speed
    if (newkeys & KEY_FIRE && StuntSuperSpeed[playerid] == true)
    {
        if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            ModifyVehicleSpeed(GetPlayerVehicleID(playerid),100);
        }
    }

    //Jump
    if (newkeys & KEY_ACTION && StuntSuperSpeed[playerid] == true)
    {
        if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new Float:Vx,Float:Vy,Float:Vz;
            GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz);
            SetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz+0.20);
        }
    }
    return 1;
}
pawn Код:
stock ModifyVehicleSpeed(vehicleid,mph) //Miles Per Hour
{
    new Float:Vx,Float:Vy,Float:Vz,Float:DV,Float:multiple;
    GetVehicleVelocity(vehicleid,Vx,Vy,Vz);
    DV = floatsqroot(Vx*Vx + Vy*Vy + Vz*Vz);
    if(DV > 0) //Directional velocity must be greater than 0 (display strobes if 0)
    {
        multiple = ((mph + DV * 100) / (DV * 100)); //Multiplying DV by 100 calculates speed in MPH
        return SetVehicleVelocity(vehicleid,Vx*multiple,Vy*multiple,Vz*multiple);
    }
    return 0;
}
Espero Ter Ajudado
Reply
#4

Desse jeito nгo teria que setar a speed pra 15?

Код:
				if(speed >= 60) {
					ModifyVehicleSpeed(GetPlayerVehicleID(playerid),15);
				}
Код:
stock ModifyVehicleSpeed(vehicleid,mph) //Miles Per Hour
{
	new Float:Vx,Float:Vy,Float:Vz,Float:DV,Float:multiple;
	GetVehicleVelocity(vehicleid,Vx,Vy,Vz);
	DV = floatsqroot(Vx*Vx + Vy*Vy + Vz*Vz);
	if(DV > 0) //Directional velocity must be greater than 0 (display strobes if 0)
	{
		multiple = ((mph + DV * 100) / (DV * 100)); //Multiplying DV by 100 calculates speed in MPH
		return SetVehicleVelocity(vehicleid,Vx*multiple,Vy*multiple,Vz*multiple);
	}
	return 0;
}
Reply
#5

Tenta, Acho Que Sim
Reply
#6

Quote:
Originally Posted by SkyneTSAMP
Посмотреть сообщение
Tenta, Acho Que Sim
Entгo... Eu tentei e nгo funcionou!
Reply
#7

Tenta:

pawn Код:
new speed, Float:Velocity[3];

speed = GetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0], Velocity[1], Velocity[2]);

if(speed >= 15.0) {

    SetVehicleVelocity(GetPlayerVehicleID(playerid), 40.0, 0.0, 0.0);

}
Reply
#8

Quote:
Originally Posted by SkyneTSAMP
Посмотреть сообщение
Tenta:

pawn Код:
new speed, Float:Velocity[3];

speed = GetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0], Velocity[1], Velocity[2]);

if(Velocity[0] >= 60.0) {

    SetVehicleVelocity(GetPlayerVehicleID(playerid), 60.0, 0.0, 0.0);

}
Nгo funcionou brother!
Reply
#9

Pode Falar Oque Deu ?
Reply
#10

Quote:
Originally Posted by SkyneTSAMP
Посмотреть сообщение
Pode Falar Oque Deu ?
obviamente nada, vocк nem usou a variбvel que criou, nгo sei usar essa funзгo, mas sei que vocк nada fez :S
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)