Boosting help - 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: Boosting help (
/showthread.php?tid=379078)
Boosting help -
Vasu99 - 20.09.2012
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 )
Re: Boosting help -
XtremeR - 20.09.2012
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!
Re: Boosting help -
xSkullx - 20.09.2012
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 !
Re: Boosting help -
Vasu99 - 20.09.2012
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
Re: Boosting help -
Danyal - 20.09.2012
show your enum so that we know which player variable's you are using for admin
Re: Boosting help -
Kyle - 20.09.2012
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 Float

peed[4];
Re: Boosting help -
Vasu99 - 20.09.2012
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 Float  peed[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
Re: Boosting help -
Vasu99 - 20.09.2012
BUMP
Re: Boosting help -
Vasu99 - 20.09.2012
Still need help..
Re: Boosting help -
C00K13M0N$73R - 20.09.2012
if(!IsPlayerAdmin(playerid)) return 0;