Help me :)
#1

Hello i need some help
I need speedboost system with
/speedboost on
/speedboost off
That's all Tnx
Reply
#2

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;
}
Reply
#3

Hi Tony,

What would the speedboost do? Give them NOS or increase their vehicle velocity?

Cheers,

TJ
Reply
#4

Snipa's code will work fine but after a small typo fix:
pawn Код:
if(newkeys && KEY_SUBMISSION)
//to:
if(newkeys & KEY_SUBMISSION)
Reply
#5

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);
                }
        }
Reply
#6

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;
}
Reply
#7

I've got errors lol
Reply
#8

Show your errors maybe i can help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)