Se puede hacer con este......
#1

Hola amigos de forum.samp tengo una duda que no se si sera posible de hacer
miren primeramente este code:

Quote:

#include <a_samp>
#define HOLDING(%0) \
((newkeys & (%0)) == (%0))
#define RELEASED(%0) \
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
new fire[MAX_PLAYERS],firee[MAX_PLAYERS],fireee[MAX_PLAYERS],fireeee[MAX_PLAYERS],fireeeee[MAX_PLAYERS],fireeeeee[MAX_PLAYERS];
new ACTD[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
ACTD[playerid] = 0;
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new model = GetPlayerVehicleID(playerid);
model = GetVehicleModel(model);
if(HOLDING(KEY_SPRINT))
{
if(model == 400||model == 401||model == 402||model == 404||model == 405||model == 410
||model == 411||model == 412||model == 413||model == 415||model == 418||model == 419
||model == 420||model == 421||model == 422||model == 426||model == 429||model == 436
||model == 438||model == 439||model == 440||model == 445||model == 451||model == 458
||model == 459||model == 466||model == 467||model == 470||model == 474||model == 475
||model == 477||model == 478||model == 479||model == 480||model == 482||model == 489
||model == 490||model == 491||model == 492||model == 494||model == 495||model == 496
||model == 500||model == 502||model == 503||model == 504||model == 505||model == 506
||model == 507||model == 516||model == 517||model == 518||model == 526||model == 527
||model == 528||model == 529||model == 533||model == 534||model == 535||model == 536
||model == 540||model == 541||model == 542||model == 543||model == 546||model == 547
||model == 549||model == 550||model == 551||model == 554||model == 555||model == 558
||model == 559||model == 560||model == 561||model == 562||model == 565||model == 566
||model == 567||model == 568||model == 575||model == 576||model == 579||model == 580
||model == 582||model == 585||model == 587||model == 589||model == 596||model == 597
||model == 598||model == 599||model == 600||model == 602||model == 603||model == 604||model == 605)
{
if(ACTD[playerid] == 0)
{
fire[playerid] = CreateObject(18694,0,0,0,0,0,0);
firee[playerid] = CreateObject(18694,0,0,0,0,0,0);
fireee[playerid] = CreateObject(18694,0,0,0,0,0,0);
fireeee[playerid] = CreateObject(18694,0,0,0,0,0,0);
AttachObjectToVehicle(fire[playerid], GetPlayerVehicleID(playerid), -0.8, 2.0, -2.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(firee[playerid], GetPlayerVehicleID(playerid), 0.8, 2.0, -2.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(fireee[playerid], GetPlayerVehicleID(playerid), -0.8, -2.0, -2.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(fireeee[playerid], GetPlayerVehicleID(playerid), 0.8, -2.0, -2.0, 0.0, 0.0, 0.0);
}
}
if(model == 465||model == 448||model == 581||model == 522||model == 461||model == 521
||model == 523||model == 463||model == 586||model == 46
{
if(ACTD[playerid] == 0)
{
fireeeee[playerid] = CreateObject(18694,0,0,0,0,0,0);
fireeeeee[playerid] = CreateObject(18694,0,0,0,0,0,0);
AttachObjectToVehicle(fireeeee[playerid], GetPlayerVehicleID(playerid), 0.0, 1.3, -2.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(fireeeeee[playerid], GetPlayerVehicleID(playerid), 0.0, -1.3, -2.0, 0.0, 0.0, 0.0);
}
}
}
else if(RELEASED(KEY_SPRINT))
{
DestroyObject(fire[playerid]);
DestroyObject(firee[playerid]);
DestroyObject(fireee[playerid]);
DestroyObject(fireeee[playerid]);
DestroyObject(fireeeee[playerid]);
DestroyObject(fireeeeee[playerid]);
}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(ACTD[playerid] == 0)
{
SendClientMessage(playerid, 0xFFFFFFFF, "{FFFFFF}Usa {FF0000}/LLamas {FFFFFF}para desactivar las llamas del vehiculo.");
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "{FFFFFF}Usa {FF0000}/LLamas {FFFFFF}para activar las llamas del vehiculo.");
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
new cmd[256];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/llamas", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(ACTD[playerid] == 0)
{
if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
ACTD[playerid] = 1;
SendClientMessage(playerid, 0xFFFFFFFF, "LLamas desactivadas");
DestroyObject(fire[playerid]);
DestroyObject(firee[playerid]);
DestroyObject(fireee[playerid]);
DestroyObject(fireeee[playerid]);
DestroyObject(fireeeee[playerid]);
DestroyObject(fireeeeee[playerid]);
}
else
{
SendClientMessage(playerid,0xFFFFFFFF, "Para desactivar las llamas debes estar en un vehiculo como conductor.");
}
}
else
{
ACTD[playerid] = 0;
SendClientMessage(playerid,0xFFFFFFFF, "LLamas activadas");
}
}
return 1;
}
return 0;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}

new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}

Miren lo que pasa es q este fs es un sistema de fuego en las ruedas que cuando pones el comando /llamas
las ruedas se encienden, quiero que sea sin comandos y bueno yo quiero lo siguiente que por ejemplo:
yo hando con mi auto infernus y cuando valla a maxima velocidad empiese a salir las llamas en las ruedas
y cuando valla bajando mi velocidad y no valla a mucha velocidad las llamas de las ruedas del auto desaparescan
espero que me haigan entendido le agaradeceria al que ayude de ante mano
saludos
Reply
#2

en OnPlayerUpdate o en un vehнculo

pawn Код:
// codigo para obtener velocidad
stock GetPlayerSpeed(playerid)
{
    new Float:ST[4];
    if(IsPlayerInAnyVehicle(playerid))
    GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
    else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
    ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 179.28625;
    return floatround(ST[3]);
}

// en OnPlayerUpdate o timer:

if(GetPlayerSpeed(playerid) > 190) // 190 km/h
{
// tu codigo
}
if(GetPlayerSpeed(playerid) < 90)
{
// tu codigo
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)