Jump to content

Question

Posted

Salut sa-mp.ro, am o problema la comanda engine. Cand intru pe server in orice masina as intra o gasesc mereu pornita, daca apasa pe 2 zice ca motorul e pornit, daca mai apas odata zice din nou ca motorul e pornit, nu se poate opriii X_X. Vreau cand intru in orice masina sami zica sa pornesc motorul.

[pawn]if (PRESSED(KEY_LOOK_BEHIND))

{

    new engine,lights,alarm,doors,bonnet,boot,objective;

if(IsPlayerInAnyVehicle(playerid))

{

    new veh = GetPlayerVehicleID(playerid);

if(veh != INVALID_VEHICLE_ID)

{

if(EngineStatus[playerid] == 0)

{

    new string[256];

    new sendername[MAX_PLAYER_NAME];

    GetPlayerName(playerid, sendername, sizeof(sendername));

GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);

SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);

EngineStatus[playerid] = 1;

SendClientMessage(playerid, 0xFFFFFFAA, "{FFFFFF}Ai {FF0000}pornit {FFFFFF} motorul!");

format(string, sizeof(string), "* %s a pornit motorul.", sendername);

        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

}

else if(EngineStatus[playerid] == 0)

{

new string[256];

    new sendername[MAX_PLAYER_NAME];

    GetPlayerName(playerid, sendername, sizeof(sendername));

GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);

SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);

EngineStatus[playerid] = 1;

SendClientMessage(playerid, 0xFFFFFFAA, "{FFFFFF}Ai {E31919}oprit {FFFFFF} motorul!");

format(string, sizeof(string), "* %s a oprit motorul.", sendername);

        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);[/pawn]

14 answers to this question

Recommended Posts

Posted

Uite aici:

if (PRESSED(KEY_LOOK_BEHIND))
	{
	    new engine,lights,alarm,doors,bonnet,boot,objective;
		if(IsPlayerInAnyVehicle(playerid))
		{
		    new veh = GetPlayerVehicleID(playerid);
	 		if(veh != INVALID_VEHICLE_ID)
			{
				if(EngineStatus[playerid] == 0)
				{
				    new string[256];
				    new sendername[MAX_PLAYER_NAME];
				    GetPlayerName(playerid, sendername, sizeof(sendername));
					GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
					EngineStatus[playerid] = 1;
					SendClientMessage(playerid, 0xFFFFFFAA, "{FFFFFF}Ai {FF0000}pornit {FFFFFF} motorul!");
					format(string, sizeof(string), "* %s a pornit motorul.", sendername);
			        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
				else if(EngineStatus[playerid] == 1)
				{
					new string[256];
				    new sendername[MAX_PLAYER_NAME];
			    	GetPlayerName(playerid, sendername, sizeof(sendername));
					GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
					EngineStatus[playerid] = 0;
					SendClientMessage(playerid, 0xFFFFFFAA, "{FFFFFF}Ai {E31919}oprit {FFFFFF} motorul!");
					format(string, sizeof(string), "* %s a oprit motorul.", sendername);
			        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

Si o idee de la mine e ca in loc de playerid la functia asta "EngineStatus[playerid]", sa faci functia sa ii seteze masini daca e pornita sau nu.

i0418xcttya707ofg.jpg

Posted

1. Cauta new EngineStatus[MAX_PLAYERS] si inlocuieste-o cu asta new EngineStatus[MAX_VEHICLES].

2. Cauta fieracre EngineStatus[playerid] si inlocuieste-o EngineStatus[vehicleid] sau EngineStatus[veh], depine cu ce functie citesti id-ul masini.

Ex: new vehicleid = GetPlayerVehicleID(playerid); sau new veh = GetPlayerVehicleID(playerid).

i0418xcttya707ofg.jpg

Posted

cu veh am eroarea

[pawn] 19443) : error 017: undefined symbol "veh"

EngineStatus[veh] = 1;[/pawn]

si cu vehicleid

[pawn](2981) : error 017: undefined symbol "vehicleid"

\(2988) : error 017: undefined symbol "vehicleid"

\(2993) : error 017: undefined symbol "vehicleid"

\(3000) : error 017: undefined symbol "vehicleid"

\(19443) : error 017: undefined symbol "vehicleid"

2988: EngineStatus[vehicleid] = 1;

2993: else if(EngineStatus[vehicleid] == 1)

3000: EngineStatus[vehicleid] = 0;

19443: EngineStatus[vehicleid] = 1;[/pawn]

Posted

cu veh am eroarea

[pawn] 19443) : error 017: undefined symbol "veh"

EngineStatus[veh] = 1;[/pawn]

si cu vehicleid

[pawn](2981) : error 017: undefined symbol "vehicleid"

\(2988) : error 017: undefined symbol "vehicleid"

\(2993) : error 017: undefined symbol "vehicleid"

\(3000) : error 017: undefined symbol "vehicleid"

\(19443) : error 017: undefined symbol "vehicleid"

2988: EngineStatus[vehicleid] = 1;

2993: else if(EngineStatus[vehicleid] == 1)

3000: EngineStatus[vehicleid] = 0;

19443: EngineStatus[vehicleid] = 1;[/pawn]

[La ce callback ai adaugat aceste linii ?

Posted

Te referi la astea?

[pawn]if (PRESSED(KEY_LOOK_BEHIND))

    {

        new engine,lights,alarm,doors,bonnet,boot,objective;

        if(IsPlayerInAnyVehicle(playerid))

        {

            new veh = GetPlayerVehicleID(playerid);

    if(veh != INVALID_VEHICLE_ID)

            {

                if(EngineStatus[vehicleid] == 0)

                {

                    new string[256];

                    new sendername[MAX_PLAYER_NAME];

                    GetPlayerName(playerid, sendername, sizeof(sendername));

                    GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);

                    SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);

                    EngineStatus[vehicleid] = 1;

                    SendClientMessage(playerid, 0xFFFFFFAA, "{FFFFFF}Ai {FF0000}pornit {FFFFFF} motorul!");

                    format(string, sizeof(string), "* %s a pornit motorul.", sendername);

                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

                }

                else if(EngineStatus[vehicleid] == 1)

                {

                    new string[256];

                    new sendername[MAX_PLAYER_NAME];

                GetPlayerName(playerid, sendername, sizeof(sendername));

                    GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);

                    SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);

                    EngineStatus[vehicleid] = 0;

                    SendClientMessage(playerid, 0xFFFFFFAA, "{FFFFFF}Ai {E31919}oprit {FFFFFF} motorul!");

                    format(string, sizeof(string), "* %s a oprit motorul.", sendername);

                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

}

}

}

}

return 1;

}[/pawn]

Posted

La comanda asta trebuia sa pui veh nu vehicleid, pentru ca ai mai sus new veh = GetPlayerVehicleID(playerid);

if (PRESSED(KEY_LOOK_BEHIND))
    {
        new engine,lights,alarm,doors,bonnet,boot,objective;
        if(IsPlayerInAnyVehicle(playerid))
        {
     		new veh = GetPlayerVehicleID(playerid);
     		if(veh != INVALID_VEHICLE_ID)
            {
                if(EngineStatus[veh] == 0)
                {
                    new string[256];
                    new sendername[MAX_PLAYER_NAME];
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    EngineStatus[veh] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "{FFFFFF}Ai {FF0000}pornit {FFFFFF} motorul!");
                    format(string, sizeof(string), "* %s a pornit motorul.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                }
                else if(EngineStatus[veh] == 1)
                {
                    new string[256];
                    new sendername[MAX_PLAYER_NAME];
                	GetPlayerName(playerid, sendername, sizeof(sendername));
                    GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                    EngineStatus[veh] = 0;
                    SendClientMessage(playerid, 0xFFFFFFAA, "{FFFFFF}Ai {E31919}oprit {FFFFFF} motorul!");
                    format(string, sizeof(string), "* %s a oprit motorul.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
			}
		}
	}
return 1;
}

i0418xcttya707ofg.jpg

Posted

La comanda asta trebuia sa pui veh nu vehicleid, pentru ca ai mai sus new veh = GetPlayerVehicleID(playerid);

if (PRESSED(KEY_LOOK_BEHIND))
    {
        new engine,lights,alarm,doors,bonnet,boot,objective;
        if(IsPlayerInAnyVehicle(playerid))
        {
     		new veh = GetPlayerVehicleID(playerid);
     		if(veh != INVALID_VEHICLE_ID)
            {
                if(EngineStatus[veh] == 0)
                {
                    new string[256];
                    new sendername[MAX_PLAYER_NAME];
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    EngineStatus[veh] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "{FFFFFF}Ai {FF0000}pornit {FFFFFF} motorul!");
                    format(string, sizeof(string), "* %s a pornit motorul.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                }
                else if(EngineStatus[veh] == 1)
                {
                    new string[256];
                    new sendername[MAX_PLAYER_NAME];
                	GetPlayerName(playerid, sendername, sizeof(sendername));
                    GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                    EngineStatus[veh] = 0;
                    SendClientMessage(playerid, 0xFFFFFFAA, "{FFFFFF}Ai {E31919}oprit {FFFFFF} motorul!");
                    format(string, sizeof(string), "* %s a oprit motorul.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
			}
		}
	}
return 1;
}

pai imi da eroarea

[pawn](19443) : error 017: undefined symbol "vehicleid"[/pawn]

Posted

S-au rezolvat erorile dar cand intru in masina tot porneste automat motorul si ma deranjeaza chestia asta deoarce la daca ma urc intr-o masina care ar trebui so cumpar porneste singura si ma pot plimba

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.