Pedido sistema de motor
#1

Querria pedirle a alguno si me podria hacer un sistema de motor basico en el que se pueda /motor(encender) - /motor (apagar) y que no podas arrancar sin prender antes el motor

El formato en strcmp porfavor, espero una ayuda
Reply
#2

Lee, https://sampforum.blast.hk/showthread.php?tid=518459
Reply
#3

Que tiene que ver eso?

Ya lei todo y cumplo con eso.
Reply
#4

Que los pedidos se hacen en ese post, no aquн
Reply
#5

pawn Код:
new bool:Motor[MAX_VEHICLES],
bool:pMotor[MAX_VEHICLES][7];
pawn Код:
#if defined FILTERSCRIPT
public OnFilterScriptInit() ManualVehicleEngineAndLights();
#else
public OnGameModeInit() ManualVehicleEngineAndLights();
#endif
pawn Код:
if(!strcmp("/motor", cmdtext)){
    new cmd[100];
    new vehicleid = GetPlayerVehicleID(playerid);
    if(IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,-1,"no estas en un vehiculo");
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)return SendClientMessage(playerid,-1,"no eres conductor");
    cmd = strtok(cmdtext, idx);
    if(!strcmp(cmd, "encender")){
        if(Motor[vehicleid] != true){
            Motor[vehicleid] = true;
            pMotor[vehicleid][0] = true;
            GetVehicleParamsEx(vehicleid, pMotor[vehicleid][0], pMotor[vehicleid][1], pMotor[vehicleid][2], pMotor[vehicleid][3], pMotor[vehicleid][4], pMotor[vehicleid][5], pMotor[vehicleid][6]);
            SetVehicleParamsEx(vehicleid, pMotor[vehicleid][0], pMotor[vehicleid][1], pMotor[vehicleid][2], pMotor[vehicleid][3], pMotor[vehicleid][4], pMotor[vehicleid][5], pMotor[vehicleid][6]);
            SendClientMessage(playerid,-1,"haz encendido el motor");
        }else{
            SendClientMessage(playerid,-1,"el motor ya esta encendido");
        }
    }
    else if(!strcmp(cmd, "apagar")){
        if(Motor[vehicleid] == true){
            Motor[vehicleid] = true;
            pMotor[vehicleid][0] = false;
            GetVehicleParamsEx(vehicleid, pMotor[vehicleid][0], pMotor[vehicleid][1], pMotor[vehicleid][2], pMotor[vehicleid][3], pMotor[vehicleid][4], pMotor[vehicleid][5], pMotor[vehicleid][6]);
            SetVehicleParamsEx(vehicleid, pMotor[vehicleid][0], pMotor[vehicleid][1], pMotor[vehicleid][2], pMotor[vehicleid][3], pMotor[vehicleid][4], pMotor[vehicleid][5], pMotor[vehicleid][6]);
            SendClientMessage(playerid,-1,"haz apagado el motor");
        }else{
            SendClientMessage(playerid,-1,"el motor no esta encendido");
        }
    }
    return true;
}
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate){
    new vehicleid = GetPlayerVehicleID(playerid);
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER){
        if(Motor[vehicleid] == true)SendClientMessage(playerid,-1,"el motor esta encendido, usa el comando /motor[apagar] para apagarlo");
        else SendClientMessage(playerid,-1,"el motor esta apagado, usa el comando /motor[encender] para encenderlo");
    }
    return true;
}
Reply
#6

Gracias por comentar OTACON pero me tira altos errores D: y no entiendo nada

E:\LSRP\gamemodes\rp.pwn(160 : error 017: undefined symbol "strtok"
E:\LSRP\gamemodes\rp.pwn(160 : error 033: array must be indexed (variable "cmd")
E:\LSRP\gamemodes\rp.pwn(1634) : warning 225: unreachable code
E:\LSRP\gamemodes\rp.pwn(1637) : warning 217: loose indentation
E:\LSRP\gamemodes\rp.pwn(1637) : error 029: invalid expression, assumed zero
E:\LSRP\gamemodes\rp.pwn(1637) : error 004: function "OnPlayerEnterVehicle" is not implemented
E:\LSRP\gamemodes\rp.pwn(1642) : warning 225: unreachable code
E:\LSRP\gamemodes\rp.pwn(1642) : error 029: invalid expression, assumed zero
E:\LSRP\gamemodes\rp.pwn(1642) : error 004: function "OnPlayerExitVehicle" is not implemented
E:\LSRP\gamemodes\rp.pwn(1647) : warning 225: unreachable code
E:\LSRP\gamemodes\rp.pwn(1647) : error 029: invalid expression, assumed zero
E:\LSRP\gamemodes\rp.pwn(1647) : error 004: function "OnPlayerStateChange" is not implemented
E:\LSRP\gamemodes\rp.pwn(1650) : error 017: undefined symbol "oldstate"
E:\LSRP\gamemodes\rp.pwn(1657) : warning 225: unreachable code
E:\LSRP\gamemodes\rp.pwn(1657) : error 029: invalid expression, assumed zero
E:\LSRP\gamemodes\rp.pwn(1657) : error 004: function "OnPlayerEnterCheckpoint" is not implemented
E:\LSRP\gamemodes\rp.pwn(1662) : warning 225: unreachable code
E:\LSRP\gamemodes\rp.pwn(1662) : error 029: invalid expression, assumed zero
E:\LSRP\gamemodes\rp.pwn(1662) : error 004: function "OnPlayerLeaveCheckpoint" is not implemented
E:\LSRP\gamemodes\rp.pwn(1667) : warning 225: unreachable code
E:\LSRP\gamemodes\rp.pwn(1667) : error 029: invalid expression, assumed zero
E:\LSRP\gamemodes\rp.pwn(1667) : error 004: function "OnPlayerEnterRaceCheckpoint" is not implemented
E:\LSRP\gamemodes\rp.pwn(1672) : warning 225: unreachable code
E:\LSRP\gamemodes\rp.pwn(1672) : error 029: invalid expression, assumed zero
E:\LSRP\gamemodes\rp.pwn(1672) : error 004: function "OnPlayerLeaveRaceCheckpoint" is not implemented
E:\LSRP\gamemodes\rp.pwn(1677) : warning 225: unreachable code
E:\LSRP\gamemodes\rp.pwn(1677) : error 029: invalid expression, assumed zero
E:\LSRP\gamemodes\rp.pwn(1677) : error 004: function "OnRconCommand" is not implemented
E:\LSRP\gamemodes\rp.pwn(1682) : warning 225: unreachable code
E:\LSRP\gamemodes\rp.pwn(1682) : error 029: invalid expression, assumed zero
E:\LSRP\gamemodes\rp.pwn(1682) : error 004: function "OnPlayerRequestSpawn" is not implemented
E:\LSRP\gamemodes\rp.pwn(1687) : warning 225: unreachable code
E:\LSRP\gamemodes\rp.pwn(1687) : error 029: invalid expression, assumed zero
E:\LSRP\gamemodes\rp.pwn(1687) : error 004: function "OnObjectMoved" is not implemented
E:\LSRP\gamemodes\rp.pwn(1692) : warning 225: unreachable code
E:\LSRP\gamemodes\rp.pwn(1692) : error 029: invalid expression, assumed zero
E:\LSRP\gamemodes\rp.pwn(1692) : error 004: function "OnPlayerObjectMoved" is not implemented
E:\LSRP\gamemodes\rp.pwn(1697) : warning 225: unreachable code
E:\LSRP\gamemodes\rp.pwn(1697) : error 029: invalid expression, assumed zero

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


26 Errors.
Reply
#7

Que gm usas?
Reply
#8

Es uno que cree desde cero por cierto:

#include <a_samp>
#include <streamer>

new bool:Motor[MAX_VEHICLES],
boolMotor[MAX_VEHICLES][7];

No me faltara algo?
Reply
#9

Quote:
Originally Posted by AlanRivarola
Посмотреть сообщение
Es uno que cree desde cero por cierto:

#include <a_samp>
#include <streamer>

new bool:Motor[MAX_VEHICLES],
boolMotor[MAX_VEHICLES][7];

No me faltara algo?
Que procesador de comando usas?
Reply
#10

Utilizo strcmp
Reply


Forum Jump:


Users browsing this thread: