Szerző Téma: Re:Auto tuning  (Megtekintve 242 alkalommal)

Re:Auto tuning
« Dátum: 2011. február 20. - 19:33:32 »
0 Show voters
És egy VehicleControl (/control)
Átírhatod a rendszámod,ki-be nyithatod az ajtót;motorh.tetõ;csomagtartót lámpákat ki be kapcsolhatod és
riasztó is van ami elég bugos:D
 
#include                  <a_samp>
#define VEHICLE_CONTROL_DIALOG  1234
#define COLOUR_INFORMATION      0xFF8C00FF
#define COLOUR_ERROR            0xFF0000FF
#define OFF                 0
#define ON                  1
#define AUTO_REOPEN_DIALOG
new Locked[MAX_PLAYERS], IsLocked[MAX_VEHICLES];
new engine, lights, alarm, doors, bonnet, boot, objective;
 
public OnPlayerConnect(playerid)
{
Locked[playerid] = 0;
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new string[128];
    format(string, sizeof(string), \"Beültél egy jármübe ID: %i\",vehicleid);
    SendClientMessage(playerid, COLOUR_INFORMATION, string);
    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(\"/control\", cmdtext, true, 10) == 0)
{
ShowVehicleControlDialog(playerid);
return 1;
}
return 0;
}
stock ShowVehicleControlDialog(playerid)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
return ShowPlayerDialog(playerid, VEHICLE_CONTROL_DIALOG, DIALOG_STYLE_LIST, \"Jármü Menu:\", \"Motor ki/be kapcsolás\\nLámpák\\nRiasztó\\nBezárás/Kinyitás \\nMotorháztetö\\nCsomagtartó\\nRendszámtábla átirás\", \"Választ\", \"Mégse\");
}
else return SendClientMessage(playerid, COLOUR_INFORMATION, \"Kocsi nélkül baszhatod:]!\");
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == VEHICLE_CONTROL_DIALOG && response)
{
switch(listitem)
{
   case 0: ShowPlayerDialog(playerid, VEHICLE_CONTROL_DIALOG+1, DIALOG_STYLE_MSGBOX, \"Jármü Menu:\", \"Elinditod/Leállítom az motort?\", \"Elindítom\", \"Leállítom\");
   case 1: ShowPlayerDialog(playerid, VEHICLE_CONTROL_DIALOG+2, DIALOG_STYLE_MSGBOX, \"Jármü Menu:\", \"{0xFFFFFF}Bekapcsolod a lámpákat?\", \"Bekapcsolom\", \"Kikapcsolom\");
   case 2: ShowPlayerDialog(playerid, VEHICLE_CONTROL_DIALOG+3, DIALOG_STYLE_MSGBOX, \"Jármü Menu:\", \"Bekapcsolod a riasztót?\", \"Bekapcsolom\", \"Kikapcsolom\");
   case 3: ShowPlayerDialog(playerid, VEHICLE_CONTROL_DIALOG+4, DIALOG_STYLE_MSGBOX, \"Jármü Menu:\", \"Bezárod/feloldod a kocsidat?\", \"Feloldom\", \"Lezárom\");
   case 4: ShowPlayerDialog(playerid, VEHICLE_CONTROL_DIALOG+5, DIALOG_STYLE_MSGBOX, \"Jármü Menu:\", \"Felnyitod a motorháztetöt? \", \"Felnyitás\", \"Lecsukás\");
   case 5: ShowPlayerDialog(playerid, VEHICLE_CONTROL_DIALOG+6, DIALOG_STYLE_MSGBOX, \"Jármü Menu:\", \"Felnyitod a csomagtartót?\", \"Felnyitás\", \"Lecsukás\");
   case 6: ShowPlayerDialog(playerid, VEHICLE_CONTROL_DIALOG+7, DIALOG_STYLE_INPUT,  \"Jármü Menu:\", \"Ird be az új rendszámot!\", \"Átirás\", \"Mégse\");
}
return 1;
}
if(dialogid == VEHICLE_CONTROL_DIALOG+1)
{
if(response)
{
            SendClientMessage(playerid, COLOUR_INFORMATION, \"Elinditotad az Enginét!\");
              GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(GetPlayerVehicleID(playerid), ON, lights, alarm, doors, bonnet, boot, objective);
}
if(!response)
{
   SendClientMessage(playerid, COLOUR_INFORMATION, \"Leálitotad az Enginét!\");
   GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
           SetVehicleParamsEx(GetPlayerVehicleID(playerid), OFF, lights, alarm, doors, bonnet, boot, objective);
}
#if defined AUTO_REOPEN_DIALOG
ShowVehicleControlDialog(playerid);
#endif
return 1;
}
if(dialogid == VEHICLE_CONTROL_DIALOG+2)
{
        if(response)
{
    SendClientMessage(playerid, COLOUR_INFORMATION, \"Bekapcsoltad a lámpát!\");
    GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
   SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, ON, alarm, doors, bonnet, boot, objective);
}
if(!response)
{
   SendClientMessage(playerid, COLOUR_INFORMATION, \"Kikapcsoltad a lámpát!\");
    GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
   SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, OFF, alarm, doors, bonnet, boot, objective);
}
#if defined AUTO_REOPEN_DIALOG
ShowVehicleControlDialog(playerid);
#endif
return 1;
}
if(dialogid == VEHICLE_CONTROL_DIALOG+3)
{
        if(response)
{
    SendClientMessage(playerid, COLOUR_INFORMATION, \"Bekapcsoltad a riasztót!\");
    GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
   SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, ON, doors, bonnet, boot, objective);
}
if(!response)
{
   SendClientMessage(playerid, COLOUR_INFORMATION, \"Kikapcsoltad a riasztót!\");
    GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
   SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, OFF, doors, bonnet, boot, objective);
}
#if defined AUTO_REOPEN_DIALOG
ShowVehicleControlDialog(playerid);
#endif
return 1;
}
if(dialogid == VEHICLE_CONTROL_DIALOG+4)
{
        if(response)
{
    SendClientMessage(playerid, COLOUR_INFORMATION, \"Kinyitottad az ajtókat!.\");
    UnlockVehicle(GetPlayerVehicleID(playerid));
}
if(!response)
{
   SendClientMessage(playerid, COLOUR_INFORMATION, \"Bezártad az ajtókat!\");
    LockVehicle(playerid, GetPlayerVehicleID(playerid));
}
#if defined AUTO_REOPEN_DIALOG
ShowVehicleControlDialog(playerid);
#endif
return 1;
}
if(dialogid == VEHICLE_CONTROL_DIALOG+5)
{
        if(response)
{
    SendClientMessage(playerid, COLOUR_INFORMATION, \"Kinyitottad a motorháztetöt!\");
    GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
   SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, ON, boot, objective);
}
if(!response)
{
   SendClientMessage(playerid, COLOUR_INFORMATION, \"Bezártad a motorháztetöt!\");
    GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
   SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, OFF, boot, objective);
}
#if defined AUTO_REOPEN_DIALOG
ShowVehicleControlDialog(playerid);
#endif
return 1;
}
if(dialogid == VEHICLE_CONTROL_DIALOG+6)
{
        if(response)
{
    SendClientMessage(playerid, COLOUR_INFORMATION, \"Kinyitottad a csomagtartót!\");
    GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
   SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, ON, objective);
}
if(!response)
{
   SendClientMessage(playerid, COLOUR_INFORMATION, \"Bezártad a csomagtartót!\");
    GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
   SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, OFF, objective);
}
#if defined AUTO_REOPEN_DIALOG
ShowVehicleControlDialog(playerid);
#endif
return 1;
}
if(dialogid == VEHICLE_CONTROL_DIALOG+7)
{
    new string[128], Float:X, Float:Y, Float:Z, Float:angle;
if(strlen(inputtext) < 1 || strlen(inputtext) > 8) return SendClientMessage(playerid, COLOUR_ERROR, \"Rosz rendszám!\");
else
{
    format(string, sizeof(string), \"Beálitottad a rendszám táblát erre: \'%s\'.\", inputtext);
    SendClientMessage(playerid, COLOUR_INFORMATION, string);
    GetPlayerPos(playerid, X, Y, Z);
    GetPlayerFacingAngle(playerid, angle);
    SetVehicleNumberPlate(GetPlayerVehicleID(playerid), inputtext);
    SetVehicleToRespawn(GetPlayerVehicleID(playerid));
   GetPlayerPos(playerid, X, Y, Z);
   SetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z);
   SetVehicleZAngle(GetPlayerVehicleID(playerid), angle);
   PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid), 0);
   SetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z+2);
}
}
return 0;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    for(new i = 0; i < MAX_PLAYERS; i ++)
{
    if(IsPlayerConnected(i) && IsLocked[vehicleid] == 1) SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, 1);
}
return 1;
}
stock LockVehicle(playerid, vehicleid)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
    if(IsPlayerConnected(i) && i != playerid)
{
    IsLocked[vehicleid] = 1;
        SetVehicleParamsForPlayer(vehicleid,i,0,1);
    }
}
}
stock UnlockVehicle(vehicleid)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
    if(IsPlayerConnected(i))
{
    IsLocked[vehicleid] = 0;
        SetVehicleParamsForPlayer(vehicleid,i,0,0);
    }
}
}

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal