Jump to content
    Bine ai venit pe comunitatea 1TAP ROMANIA!

Citeste regulamentul comunitatii pentru a evita toate incidentele neplacute!

REGULAMENT

Te plictisesti? Te invitam pe serverele noastre!

SERVERE COMUNITARE

Acceptam servere de orice tip!

CERERE DNS

Linkuri utile

FreakHosting
FreakHosting
FreakHosting
FreakHosting
FreakHosting
Sign in to follow this  
Impulsive.

[Tutorial] Modificarea vitezei vehicul

Recommended Posts

Incepem prin a defini variabilile de care ne vom folosi:

Adaugati tot de mai jos undeva la inceputul gamemode-ului.

#define SPEED_MULTIPLIER 1.025
#define SPEED_THRESHOLD  0.4
#define  SpeedUPCheck(%0,%1,%2,%3,%4)  floatround(floatsqroot(%4?(%0*%0+%1*%1+%2*%2):(%0*%0+%1*%1) ) *%3*1.7)
new g_SpeedUpTimer = -1, Float:g_SpeedThreshold, maxSpeed[MAX_VEHICLES];

Adaugati tot de mai jos in OnGameModeInit().

g_SpeedThreshold = SPEED_THRESHOLD * SPEED_THRESHOLD;
g_SpeedUpTimer = SetTimer("SpeedUP", 250, true);

Adaugati tot de mai jos undeva prin gamemode.

forward SpeedUP();
public SpeedUP[250]() {
	foreach(new playerid : Player) {
        new vehicleid = GetPlayerVehicleID(playerid), Float:vx, Float:vy, Float:vz, viteza = GetPlayerSpeedUP(playerid, 0);
		if(IsPlayerInAnyVehicle(playerid)) {
     		GetVehicleVelocity(vehicleid, vx, vy, vz);
            if(vx * vx + vy * vy < g_SpeedThreshold)
                continue;

            vx *= SPEED_MULTIPLIER;
            vy *= SPEED_MULTIPLIER;

            if (vz > 0.04 || vz < -0.04)
            vz -= 0.020;
			if(viteza < maxSpeed[vehicleid])
				SetVehicleVelocity(vehicleid, vx, vy, vz);
		}
    }
}

Adaugati tot de mai jos undeva prin gamemode.

stock GetPlayerSpeedUP(playerid, get3d) {
	new veh = GetPlayerVehicleID(playerid), Float:FlSP[3];
	GetVehicleVelocity(veh, FlSP[0], FlSP[1], FlSP[2]), SpeedUPCheck(FlSP[0], FlSP[1], FlSP[2], 100.0, get3d);
	return 1;
}

Adaugati comanda undeva prin gamemode.

CMD:maxspeedup(playerid, params[]) {
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "** Nu te afli intr-un vehicul.");
	new speed, veh = GetPlayerVehicleID(playerid), string[51];
    if(sscanf(params, "i", speed)) return SendClientMessage(playerid, -1, "/maxspeedup [speed]");
    switch(speed) {
        case 0: return SendClientMessage(playerid, -1, "** Max speed-ul a fost eliminat!"), maxSpeed[veh] = 0, 0;
    }
    maxSpeed[veh] = speed;
    format(string, sizeof string, "** Vehiculul #%d detine acum maxSpeed-ul #%d.", veh, maxSpeed[veh]);
	SendClientMessage(playerid, -1, string);
	return 1;
}

Pentru a elimina max speed-ul de pe un vehicul tastati comanda:

[/maxspeedup 0]

 

Share this post


Link to post
Share on other sites

Multumim . T/C

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  



Theme made by CodeBite & raduly for 1TAP COMMUNITY!

Comunitatea 1TAP Romania

Comunitatea 1TAP ROMANIA a fost infiintata cu scopul de a atrage jucatorii de Counter Strike:Global Offensive si nu numai, pentru a le oferi un mediu mai bun si placut unde sa isi petreaca timpul liber alaturi de prietenii lor!

Ne-am facut recunoscuti prima data prin serverul nostru LOCUL 1 in Romania, "ARENA.1TAP.RO", si odata cu timpul ne-am extins si cu serverul de FiveM, ajungand locul 1 si el!


Copyright 2020 © FREAK Powered by Invision Community

×
×
  • Create New...