Boosting help
#1

Hey I want to know how I can create a command that will boost my car. I mean so if I enter the command in the game the vehicle I am in will boost ( go up in a very high speed )
Reply
#2

pawn Код:
new EnableBoast[MAX_PLAYERS];//at the top

public OnPlayerSpawn(playerid)
{
EnableBoast[playerid] = 0;
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/Boost", true))
    {
    if(EnableBoast[playerid])
    {
    EnableBoast[playerid] = 0; //will enable boast
    SendClientMessage(playerid, 0x924161FF, "Boost Deactivated.");
 
    }
    else
    {
    EnableBoast[playerid] = 1; //will enable boast
    SendClientMessage(playerid, 0x924161FF, "Boost Activated.");
 
    }
    return 1;
    }
        return 0;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
 
        if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
 
        if(newkeys & KEY_FIRE)
        {
 
 
 
        if(EnableBoast[playerid] == 1)
        {
        new Float:vx,Float:vy,Float:vz;
        GetVehicleVelocity(GetPlayerVehicleID(playerid),vx,vy,vz);
        SetVehicleVelocity(GetPlayerVehicleID(playerid), vx * 1.8, vy *1.8, vz * 1.8);
        }
        }
        }
 
 
        if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
        if (newkeys & KEY_CROUCH)
        {
 
        if(EnableBoast[playerid] == 1)
        {
        new Float:x, Float:y, Float:z;
        GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
        SetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z+0.3);
        }
        }
        }
        return 1;
        }
Hope That Helps!
Reply
#3

pawn Код:
if(PRESSED(KEY_FIRE))
    {
        new Float:speed[4];
        GetVehicleZAngle(GetPlayerVehicleID(playerid), speed[3]);
        GetVehicleVelocity(GetPlayerVehicleID(playerid), speed[0], speed[1], speed[2]);
        SetVehicleVelocity(GetPlayerVehicleID(playerid),((floatadd(speed[0],floatmul(1.01,floatsin(-speed[3],degrees))))*2)/3, ((floatadd(speed[1],floatmul(1.01,floatcos(-speed[3],degrees))))*2)/3, speed[2]);
    }
Try this. If it gives errors post it here, i maked it quick !
Reply
#4

Quote:
Originally Posted by xSkullx
Посмотреть сообщение
pawn Код:
if(PRESSED(KEY_FIRE))
    {
        new Float:speed[4];
        GetVehicleZAngle(GetPlayerVehicleID(playerid), speed[3]);
        GetVehicleVelocity(GetPlayerVehicleID(playerid), speed[0], speed[1], speed[2]);
        SetVehicleVelocity(GetPlayerVehicleID(playerid),((floatadd(speed[0],floatmul(1.01,floatsin(-speed[3],degrees))))*2)/3, ((floatadd(speed[1],floatmul(1.01,floatcos(-speed[3],degrees))))*2)/3, speed[2]);
    }
Try this. If it gives errors post it here, i maked it quick !
Can you make it so only admins can do this? And can you make it so its alt key
Reply
#5

show your enum so that we know which player variable's you are using for admin
Reply
#6

If you know your variable for an admin level such as:

Admin[playerid] add an if statement such as this if(Admin[playerid] == 0) return 1;

In the code just above new Floatpeed[4];
Reply
#7

Quote:
Originally Posted by KyleSmith
Посмотреть сообщение
If you know your variable for an admin level such as:

Admin[playerid] add an if statement such as this if(Admin[playerid] == 0) return 1;

In the code just above new Floatpeed[4];
Sorry but I dont understand that kind of pawno language xD. I have san fierro cops n robbers by stevo if thats what you're askin :P
Reply
#8

BUMP
Reply
#9

Still need help..
Reply
#10

if(!IsPlayerAdmin(playerid)) return 0;
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)