How to change player sprint with velocity ?
#1

Hi, sorry for my bad english ...

I try to change the speed of the player with :

Код:
new Float:vx,Float:vy,Float:vz;
        GetPlayerVelocity(playerid,vx,vy,vz);
        SetPlayerVelocity(playerid, vx * 5.8, vy *5.8, vz );
But the result is not good and I lost health

Do you have an idea to sprint faster ?

Thank you in advance !

D0os
Reply
#2

Try This:
OnDialogResponse :
new VS[500], KS1[300], KS2[35];
if(dialogid == SB)
{
if(response == 1)
{
new VValue = strval(inputtext);
if(!inputtext[0]) return ShowPlayerDialog(playerid, SB, DIALOG_STYLE_INPUT, " ", "\t\t {4077F7}[SIZE]\n\n{FFFFFF}Please insert the value for your car velocity.\nValues are: {7F7F7F}1{FFFFFF} - {7F7F7F}3","Ok","Exit");
if(!IsNumeric(inputtext[0])) return ShowPlayerDialog(playerid, SB, DIALOG_STYLE_INPUT, " ", "\t\t {AA3333}[ERROR]\n\n{FFFFFF}Only numbers allowed.\nPlease insert the height for your car velocity!\nValues are: {7F7F7F}1{FFFFFF} - {7F7F7F}3","Ok","Exit");
if(inputtext[0] > '3') return ShowPlayerDialog(playerid, SB, DIALOG_STYLE_INPUT, " ", "\t {AA3333}[ERROR]\n\n{FFFFFF}Invalid value.\nPlease insert again!\nValues are: {7F7F7F}1{FFFFFF} - {7F7F7F}3","Ok","Exit");
if(inputtext[0] == '0') return ShowPlayerDialog(playerid, SB, DIALOG_STYLE_INPUT, " ", "\t {AA3333}[ERROR]\n\n{FFFFFF}Value 0 is incorrect.\nPlease insert again!\nValues are: {7F7F7F}1{FFFFFF} - {7F7F7F}3","Ok","Exit");

Sb[playerid] = 1;
Velocity[playerid] = VValue;
format(VS, sizeof(VS), "\t\t {4077F7}[KEY's]\n\n{FFFFFF}You selected value {7F7F7F}%d{FFFFFF}!\nNow, select the number to select the button with wich\nyou will have to press to jump\nWrite:\n\t{7F7F7F}1 {FFFFFF}- {67A9F7}Horn Key(H)\n\t{7F7F7F}2 {FFFFFF}- {67A9F7}Left CTRL(CTRL)\n\t{7F7F7F}3 {FFFFFF}- {67A9F7}Left Click(FIRE)",Velocity[playerid]);
return ShowPlayerDialog(playerid, SBK, DIALOG_STYLE_INPUT, " ", VS,"Ok","Exit");
}
}
if(dialogid == SBK)
{
if(response == 1)
{
if(!inputtext[0]) return format(VS, sizeof(VS), "\t\t {AA3333}[ERROR]\n\n{FFFFFF}No number found in the input!\nWrite:\n\t{7F7F7F}1 {FFFFFF}- {67A9F7}Horn Key(H)\n\t{7F7F7F}2 {FFFFFF}- {67A9F7}Left CTRL(CTRL)\n\t{7F7F7F}3 {FFFFFF}- {67A9F7}Left Click(FIRE)",Velocity[playerid]), ShowPlayerDialog(playerid, SBK, DIALOG_STYLE_INPUT, " ", VS,"Ok","Exit");
if(!IsNumeric(inputtext[0])) return ShowPlayerDialog(playerid, SBK, DIALOG_STYLE_INPUT, " ", "\t\t {AA3333}[ERROR]\n\n{FFFFFF}Only numbers allowed!\nSelect a number to select the button with wich\nyou will have to press to jump\nWrite:\n\t{7F7F7F}1 {FFFFFF}- {67A9F7}Horn Key(H)\n\t{7F7F7F}2 {FFFFFF}- {67A9F7}Left CTRL(CTRL)\n\t{7F7F7F}3 {FFFFFF}- {67A9F7}Left Click(FIRE)","Ok","Exit");
if(inputtext[0] > '3') return format(KS1, sizeof(KS1), "\t {AA3333}[ERROR]\n\n{FFFFFF}There is no number %d in the list bellow!\nWrite:\n\t{7F7F7F}1 {FFFFFF}- {67A9F7}Horn Key(H)\n\t{7F7F7F}2 {FFFFFF}- {67A9F7}Left CTRL(CTRL)\n\t{7F7F7F}3 {FFFFFF}- {67A9F7}Left Click(FIRE)",inputtext,Velocity[playerid]), ShowPlayerDialog(playerid, SBK, DIALOG_STYLE_INPUT, " ", KS1,"Ok","Exit");
if(inputtext[0] == '1') SbK[playerid] = 1, KS2 = "{67A9F7}Horn Key(H){FFFFFF}";
if(inputtext[0] == '2') SbK[playerid] = 2, KS2 = "{67A9F7}Left CTRL(CTRL){FFFFFF}";
if(inputtext[0] == '3') SbK[playerid] = 3, KS2 = "{67A9F7}Left Click(Fire){FFFFFF}";
format(KS1, sizeof(KS1), "\t\t {4077F7}[INFO]\n\n{FFFFFF}You selected %s{FFFFFF}, now press it for SPEED!\nType {F40900}/sboff {FFFFFF}to disable it!",KS2);
return ShowPlayerDialog(playerid, SB2, DIALOG_STYLE_MSGBOX," ", KS1,"Ok","");
}
}

OnPlayerCommandText:

CMDboost(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid)) ShowPlayerDialog(playerid, SB, DIALOG_STYLE_INPUT, " ", "\t\t {4077F7}[SIZE]\n\n{FFFFFF}Please insert the height for your car velocity!\nValues are: {7F7F7F}1{FFFFFF} - {7F7F7F}3","Ok","Exit");
else SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}Nu esti in niciun fel de vehicul.");
return 1;
}
CMDb(playerid, params[]) return cmd_sboost(playerid, params);

CMDboff(playerid, params[])
{
if(Sb[playerid] == 0) return ShowPlayerDialog(playerid, SB2, DIALOG_STYLE_MSGBOX, "[ERROR]:", "{F40900}/sboost {FFFFFF}is currently OFF! \nTo enable it type {F40900}/sb {FFFFFF}and type the requested numbers.","Ok","");
Sb[playerid] = 0;
Velocity[playerid] = 0;
return ShowPlayerDialog(playerid, SB2, DIALOG_STYLE_MSGBOX, " ", "\t\t{4077F7}[INFO]\n\n{FFFFFF}You stopped from using {F40900}/sb{FFFFFF}.\nType {F40900}/sb {FFFFFF}again FOR SPEED!\n Current value: {7F7F7F}0","Ok","");
}
CMDpeedboostoff(playerid, params[]) return cmd_sboff(playerid, params);
Reply
#3

Same as above but with pawn wrappers...
pawn Код:
OnDialogResponse :
    new VS[500], KS1[300], KS2[35];
    if(dialogid == SB)
    {
        if(response == 1)
        {
            new VValue = strval(inputtext);
            if(!inputtext[0]) return ShowPlayerDialog(playerid, SB, DIALOG_STYLE_INPUT, " ", "\t\t     {4077F7}[SIZE]\n\n{FFFFFF}Please insert the value for your car velocity.\nValues are: {7F7F7F}1{FFFFFF} - {7F7F7F}3","Ok","Exit");
            if(!IsNumeric(inputtext[0])) return ShowPlayerDialog(playerid, SB, DIALOG_STYLE_INPUT, " ", "\t\t   {AA3333}[ERROR]\n\n{FFFFFF}Only numbers allowed.\nPlease insert the height for your car velocity!\nValues are: {7F7F7F}1{FFFFFF} - {7F7F7F}3","Ok","Exit");
            if(inputtext[0] > '3') return ShowPlayerDialog(playerid, SB, DIALOG_STYLE_INPUT, " ", "\t           {AA3333}[ERROR]\n\n{FFFFFF}Invalid value.\nPlease insert again!\nValues are: {7F7F7F}1{FFFFFF} - {7F7F7F}3","Ok","Exit");
            if(inputtext[0] == '0') return ShowPlayerDialog(playerid, SB, DIALOG_STYLE_INPUT, " ", "\t           {AA3333}[ERROR]\n\n{FFFFFF}Value 0 is incorrect.\nPlease insert again!\nValues are: {7F7F7F}1{FFFFFF} - {7F7F7F}3","Ok","Exit");

            Sb[playerid] = 1;
            Velocity[playerid] = VValue;
            format(VS, sizeof(VS), "\t\t       {4077F7}[KEY's]\n\n{FFFFFF}You selected value {7F7F7F}%d{FFFFFF}!\nNow, select the number to select the button with wich\nyou will have to press to jump\nWrite:\n\t{7F7F7F}1 {FFFFFF}- {67A9F7}Horn Key(H)\n\t{7F7F7F}2 {FFFFFF}- {67A9F7}Left CTRL(CTRL)\n\t{7F7F7F}3 {FFFFFF}- {67A9F7}Left Click(FIRE)",Velocity[playerid]);
            return ShowPlayerDialog(playerid, SBK, DIALOG_STYLE_INPUT, " ", VS,"Ok","Exit");
        }
    }
    if(dialogid == SBK)
    {
        if(response == 1)
        {
            if(!inputtext[0]) return format(VS, sizeof(VS), "\t\t   {AA3333}[ERROR]\n\n{FFFFFF}No number found in the input!\nWrite:\n\t{7F7F7F}1 {FFFFFF}- {67A9F7}Horn Key(H)\n\t{7F7F7F}2 {FFFFFF}- {67A9F7}Left CTRL(CTRL)\n\t{7F7F7F}3 {FFFFFF}- {67A9F7}Left Click(FIRE)",Velocity[playerid]), ShowPlayerDialog(playerid, SBK, DIALOG_STYLE_INPUT, " ", VS,"Ok","Exit");
            if(!IsNumeric(inputtext[0])) return ShowPlayerDialog(playerid, SBK, DIALOG_STYLE_INPUT, " ", "\t\t   {AA3333}[ERROR]\n\n{FFFFFF}Only numbers allowed!\nSelect a number to select the button with wich\nyou will have to press to jump\nWrite:\n\t{7F7F7F}1 {FFFFFF}- {67A9F7}Horn Key(H)\n\t{7F7F7F}2 {FFFFFF}- {67A9F7}Left CTRL(CTRL)\n\t{7F7F7F}3 {FFFFFF}- {67A9F7}Left Click(FIRE)","Ok","Exit");
            if(inputtext[0] > '3') return format(KS1, sizeof(KS1), "\t           {AA3333}[ERROR]\n\n{FFFFFF}There is no number %d in the list bellow!\nWrite:\n\t{7F7F7F}1 {FFFFFF}- {67A9F7}Horn Key(H)\n\t{7F7F7F}2 {FFFFFF}- {67A9F7}Left CTRL(CTRL)\n\t{7F7F7F}3 {FFFFFF}- {67A9F7}Left Click(FIRE)",inputtext,Velocity[playerid]), ShowPlayerDialog(playerid, SBK, DIALOG_STYLE_INPUT, " ", KS1,"Ok","Exit");
            if(inputtext[0] == '1') SbK[playerid] = 1, KS2 = "{67A9F7}Horn Key(H){FFFFFF}";
            if(inputtext[0] == '2') SbK[playerid] = 2, KS2 = "{67A9F7}Left CTRL(CTRL){FFFFFF}";
            if(inputtext[0] == '3') SbK[playerid] = 3, KS2 = "{67A9F7}Left Click(Fire){FFFFFF}";
            format(KS1, sizeof(KS1), "\t\t        {4077F7}[INFO]\n\n{FFFFFF}You selected %s{FFFFFF}, now press it for SPEED!\nType {F40900}/sboff {FFFFFF}to disable it!",KS2);
            return ShowPlayerDialog(playerid, SB2, DIALOG_STYLE_MSGBOX," ", KS1,"Ok","");
        }
    }

OnPlayerCommandText:

CMD:sboost(playerid, params[])
{
    if(IsPlayerInAnyVehicle(playerid)) ShowPlayerDialog(playerid, SB, DIALOG_STYLE_INPUT, " ", "\t\t    {4077F7}[SIZE]\n\n{FFFFFF}Please insert the height for your car velocity!\nValues are: {7F7F7F}1{FFFFFF} - {7F7F7F}3","Ok","Exit");
    else SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}Nu esti in niciun fel de vehicul.");
    return 1;
}
CMD:sb(playerid, params[]) return cmd_sboost(playerid, params);

CMD:sboff(playerid, params[])
{
    if(Sb[playerid] == 0) return ShowPlayerDialog(playerid, SB2, DIALOG_STYLE_MSGBOX, "[ERROR]:", "{F40900}/sboost {FFFFFF}is currently OFF! \nTo enable it type {F40900}/sb {FFFFFF}and type the requested numbers.","Ok","");
    Sb[playerid] = 0;
    Velocity[playerid] = 0;
    return ShowPlayerDialog(playerid, SB2, DIALOG_STYLE_MSGBOX, " ", "\t\t{4077F7}[INFO]\n\n{FFFFFF}You stopped from using {F40900}/sb{FFFFFF}.\nType {F40900}/sb {FFFFFF}again FOR SPEED!\n  Current value: {7F7F7F}0","Ok","");
}
CMD:speedboostoff(playerid, params[]) return cmd_sboff(playerid, params);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)