Szerző Téma: Samp lampa script  (Megtekintve 1435 alkalommal)

Samp lampa script
« Dátum: 2015. május 21. - 14:34:21 »
0 Show voters
sziaztok
hogy tudom megcsinálni a lampa script hogy napal is menyen a lampa ?
Spoiler for Fordítás by.Martin:
Sziasztok!
Hogy tudom megcsinálni azt, hogy nappal is világítson a lámpa?
 
/*
        Vehicle Headlight\'s Filterscript
        Toggle you vehicles lights on/off :)
        Created by: Anwix (http://forum.sa-mp.com/index.php?action=profile;u=12730)
        Thanks to:
         ~ JernejL (RedShirt) - Encode Lights Script
                                            */
#include <a_samp>
new bool: VehicleLightsOn[MAX_VEHICLES];
new panels, doors, lights, tires;
#define PRESSED(%0) \\
        (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnFilterScriptInit()
{
        print(\"\\n--------------------------------------\");
        print(\" Vehicle Lights Filterscript Loaded\");
        print(\"--------------------------------------\\n\");
        for (new x = 1; x < MAX_VEHICLES; x++)
        {
                VehicleLightsOn
  • = false;

        }
        return 1;
}
public OnFilterScriptExit()
{
    print(\"\\n--------------------------------------\");
        print(\" Vehicle Lights Filterscript Unloaded\");
        print(\"--------------------------------------\\n\");
        return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
        if (newstate == PLAYER_STATE_DRIVER)
        {
            if (VehicleLightsOn[GetPlayerVehicleID(playerid)] == false)
            {
                        GetVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, tires);
                UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, encode_lights(1, 1, 1, 1), tires);
                        VehicleLightsOn[GetPlayerVehicleID(playerid)] = false;
            }
            else
            {
                        GetVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, tires);
                UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, encode_lights(0, 0, 0, 0), tires);
                VehicleLightsOn[GetPlayerVehicleID(playerid)] = true;
                }
        }
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
        if (PRESSED(KEY_ACTION))
        {
            if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                if (VehicleLightsOn[GetPlayerVehicleID(playerid)] == false)
                {
                GetVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, tires);
                        UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, encode_lights(0, 0, 0, 0), tires);
                VehicleLightsOn[GetPlayerVehicleID(playerid)] = true;
                }
                else
                {
                        GetVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, tires);
                        UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, encode_lights(1, 1, 1, 1), tires);
                        VehicleLightsOn[GetPlayerVehicleID(playerid)] = false;
                        }
                }
        }
        return 1;
}
/*      Thanks to JernejL (RedShirt) for encode_lights   */
stock encode_lights(light1, light2, light3, light4)
{
        return light1 | (light2 << 1) | (light3 << 2) | (light4 << 3);
}
« Utoljára szerkesztve: 2015. május 23. - 23:09:49 írta ƒlaﻛh »

Nem elérhető Lofoli

  • 296
    • Profil megtekintése
Samp lampa script
« Válasz #1 Dátum: 2015. május 21. - 14:58:33 »
+1 Show voters
Szejvusz!!
 

#include a_samp
#include zcmd
CMD:lampa(playerid, params[])
{if(IsPlayerInAnyVehicle(playerid)){
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(lights == 1){
SetVehicleParamsEx(vehicleid, engine, 0, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid,-1, \"Lámpa Kikapcsolva\");}else{
SetVehicleParamsEx(vehicleid, engine, 1, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid,-1,\"Lámpa Bekapcsolva\");}
}else{SendClientMessage(playerid,-1, \"Ez Kocsi Parancs!\");}
return 1;}

 
NEM Teszteltem

Nem elérhető DrAkE

  • 2078
    • Profil megtekintése
Samp lampa script
« Válasz #2 Dátum: 2015. május 21. - 15:12:38 »
+2 Show voters
Idézetet írta: LoFoLi. date=1432213113\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"54390\" data-ipsquote-contentclass=\"forums_Topic
Szejvusz!!
 

#include a_samp
#include zcmd
CMD:lampa(playerid, params[])
{if(IsPlayerInAnyVehicle(playerid)){
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(lights == 1){
SetVehicleParamsEx(vehicleid, engine, 0, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid,-1, \"Lámpa Kikapcsolva\");}else{
SetVehicleParamsEx(vehicleid, engine, 1, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid,-1,\"Lámpa Bekapcsolva\");}
}else{SendClientMessage(playerid,-1, \"Ez Kocsi Parancs!\");}
return 1;}

 
NEM Teszteltem
 
Szijjja, elég undojító a kódod!
https://wiki.sa-mp.com/wiki/ManualVehicleEngineAndLights

Samp lampa script
« Válasz #3 Dátum: 2015. május 28. - 17:29:04 »
0 Show voters
hát igy kéne strcmp,cmd script kéne

Nem elérhető Lofoli

  • 296
    • Profil megtekintése
Samp lampa script
« Válasz #4 Dátum: 2015. május 28. - 17:35:36 »
0 Show voters
Idézetet írta: willianhunt date=1432826944\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"54390\" data-ipsquote-contentclass=\"forums_Topic
hát igy kéne strcmp,cmd script kéne
 


#include a_samp
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, \"/lampa\", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid)){
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(lights == 1){
SetVehicleParamsEx(vehicleid, engine, 0, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid,-1, \"Lámpa Kikapcsolva\");}else{
SetVehicleParamsEx(vehicleid, engine, 1, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid,-1,\"Lámpa Bekapcsolva\");}
}else{SendClientMessage(playerid,-1, \"Ez Kocsi Parancs!\");}
return 1;
}
return 0;
}
« Utoljára szerkesztve: 2015. május 28. - 17:50:29 írta LoFoLi. »

Nem elérhető Flash

  • 5726
  • (っ◕‿◕)っ
    • Profil megtekintése
Samp lampa script
« Válasz #5 Dátum: 2015. június 06. - 20:40:58 »
0 Show voters
[mod]Zárok![/mod]

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal