Help me :) - 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: Help me :) (
/showthread.php?tid=325559)
Help me :) -
[BP]Tony - 13.03.2012
Hello i need some help
I need speedboost system with
/speedboost on
/speedboost off
That's all Tnx
Re: Help me :) -
Snipa - 13.03.2012
pawn Код:
#include <a_samp>
#include <zcmd>
new speed[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
speed[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid)
{
speed[playerid] = 0;
return 1;
}
CMD:speedboost(playerid, params[])
{
if(speed[playerid] == 0) {
speed[playerid] = 1;
}
else
{
speed[playerid] = 0;
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(newkeys && KEY_SUBMISSION) {
if(speed[playerid] == 1) {
new Float:vx,Float:vy,Float:vz;
GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);
SetVehicleVelocity(vehicleid, vx * 2, vy * 2, vz * 2);
return 1;
}
}
}
return 1;
}
Re: Help me :) -
TTJJ - 13.03.2012
Hi Tony,
What would the speedboost do? Give them NOS or increase their vehicle velocity?
Cheers,
TJ
Re: Help me :) -
iPLEOMAX - 13.03.2012
Snipa's code will work fine but after a small typo fix:
pawn Код:
if(newkeys && KEY_SUBMISSION)
//to:
if(newkeys & KEY_SUBMISSION)
Re: Help me :) -
[BP]Tony - 13.03.2012
Hmm? I can't see where the players can make /sb on /sb off ?
I can make this i made it with KEY_FIRE
pawn Код:
if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if (newkeys & KEY_FIRE)
{
new Float:vehx; new Float:vehy; new Float:vehz;
GetVehicleVelocity(vehicleid,vehx,vehy,vehz);
SetVehicleVelocity(vehicleid,vehx*SpeedBoost,vehy*SpeedBoost,vehz*SpeedBoost);
}
}
Re: Help me :) -
iPLEOMAX - 13.03.2012
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/sb", true, 3))
return speed[playerid] ? (speed[playerid] = false) : (speed[playerid] = true);
//Other commands here...
return 1;
}
Re: Help me :) -
[BP]Tony - 14.03.2012
I've got errors lol
Re: Help me :) -
Reklez - 14.03.2012
Show your errors maybe i can help