13.03.2012, 20:30
Hello i need some help
I need speedboost system with
/speedboost on
/speedboost off
That's all Tnx
I need speedboost system with
/speedboost on
/speedboost off
That's all Tnx
#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;
}
if(newkeys && KEY_SUBMISSION)
//to:
if(newkeys & KEY_SUBMISSION)
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);
}
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/sb", true, 3))
return speed[playerid] ? (speed[playerid] = false) : (speed[playerid] = true);
//Other commands here...
return 1;
}