How can I disable speedboost in races? - 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: How can I disable speedboost in races? (
/showthread.php?tid=326831)
How can I disable speedboost in races? -
OleKristian95 - 18.03.2012
I want my speedboost disabled in races but I don't know how..
This is my speedboost
Код:
//-------------------------------------------------------------------SpeedBoost
if ((newkeys & KEY_ANALOG_UP) && !(oldkeys & KEY_ANALOG_UP) && IsPlayerInAnyVehicle(playerid) ){
if(PlayerInfo[playerid][Level] >= 0) {
{
new Float:vx, Float:vy, Float:vz;
GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);
SetVehicleVelocity(GetPlayerVehicleID(playerid) ,vx*1.5,vy*1.5 ,vz*1.5);
}
}
}
The race script I am using is Yagu's Race Filterscript or something like that.
Re: How can I disable speedboost in races? -
Babul - 18.03.2012
if your speedboost is inside the gamemode script, while the race is a filterscript, you can let the race filterscript change a PVar at the race join command:
pawn Код:
SetPVarInt(playerid,"InRace",1);
..and use that variable in the gamemode aswell:
pawn Код:
if(GetPVarInt(playerid,"InRace")!=1)
{
if ((newkeys & KEY_ANALOG_UP) && !(oldkeys & KEY_ANALOG_UP) && IsPlayerInAnyVehicle(playerid) )
{
if(PlayerInfo[playerid][Level] >= 0)
{
new Float:vx, Float:vy, Float:vz;
GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);
SetVehicleVelocity(GetPlayerVehicleID(playerid) ,vx*1.5,vy*1.5 ,vz*1.5);
}
}
}
dont forget to clear/delete the variable, or set it to 0, when the race is finshed. it gets deleted when a player disconencts, so you only need to take care for the /exitrace or similar:
pawn Код:
DeletePVar(playerid,"InRace");
Re: How can I disable speedboost in races? -
OleKristian95 - 04.04.2012
Both is in the gamemode
thanks for the help btw