Jump to content
  • 0

Problema intrare vehicul personal.


Cosmarul

Question

Problema intalnita (descriere):Poi, vreau sa fac ca proprietarul masini sa poata intra in masina fara ca masina sa fie descuiata... dar nu prea merge. Eu am adaugat la functie codul "vInfo[OwnedVeh(vid)][vOwner] == GetName(playerid))".
Ero(area / rile) / warning-(ul / urile):

Toata Functia:

		if(OwnedVeh(vid) != 0)
		{
			new iMsg[128];
			if(vInfo[OwnedVeh(vid)][vDestroyed] == 1 && !strmatch(vInfo[OwnedVeh(vid)][vOwner], "Unbought") && OdoVehicle(GetVehicleModel(vid)) == 1)
			{
				if(strmatch(vInfo[OwnedVeh(vid)][vOwner], GetName(playerid)))
				{
					new insurance = 100 + floatround(vInfo[OwnedVeh(vid)][vKm]);
					format(iMsg, sizeof(iMsg), "This vehicle is damaged.\nYou need to pay $%s.", FormatNumber(insurance));

					ShowPlayerDialog(playerid,DIALOG_INS,DIALOG_STYLE_MSGBOX,"INSURANCE",iMsg,"Pay","Exit");
					TogglePlayerControllableEx(playerid, false);
				}
				else
				{
					SendClientMessage(playerid, COLOR_SYN2, "This vehicle is damaged, type /exit.");
					TogglePlayerControllableEx(playerid, false);
				}
			}
			else if(strmatch(vInfo[OwnedVeh(vid)][vOwner], GetName(playerid)))
			{
				format(iMsg, sizeof(iMsg), "Welcome to your vehicle, %s.", GetName(playerid));
				SendClientMessage(playerid, COLOR_SYN2, iMsg);
			}
			else if(!strmatch(vInfo[OwnedVeh(vid)][vOwner], GetName(playerid)))
			{
				if(PlayerInfo[playerid][pAdmin] < 5 && vInfo[OwnedVeh(vid)][vLocked] == 1 || vInfo[OwnedVeh(vid)][vOwner] == GetName(playerid))
				{
					SendClientMessage(playerid, COLOR_SYN2, "This vehicle is locked, type /exit.");
					TogglePlayerControllableEx(playerid, false);
				}
				else
				{
					format(iMsg, sizeof(iMsg), "This vehicle is owned by %s.", vInfo[OwnedVeh(vid)][vOwner]);
					SendClientMessage(playerid, COLOR_SYN2, iMsg);
				}
			}
		}
		

Linia cu eroarea:

if(PlayerInfo[playerid][pAdmin] < 5 && vInfo[OwnedVeh(vid)][vLocked] == 1 || vInfo[OwnedVeh(vid)][vOwner] == GetName(playerid))

Eroarea primita:

error 033: array must be indexed (variable "GetName")


Liniile de cod / sursa / script-ul(obligatoriu): Mai sus.
Imagini / Video (optional):
Ati incercat sa rezolvati singur?: Da.

PS: Folosesc gm vProject.

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0
if(PlayerInfo[playerid][pAdmin] < 5 && vInfo[OwnedVeh(vid)][vLocked] == 1 || !strcmp(vInfo[OwnedVeh(vid)][vOwner], GetName(playerid), false))

Foloseste functia strcmp pentru a face comparatiile respective: https://wiki.sa-mp.com/wiki/Strcmp

if(PlayerInfo[playerid][pAdmin] < 5 && vInfo[OwnedVeh(vid)][vLocked] == 1 || !strcmp(vInfo[OwnedVeh(vid)][vOwner], GetName(playerid), false))

Cam asa trebuie sa arate.

Cea mai sigura sursa de facut bani de buzunar in mediul virtual. Inregistreaza-te si pune-te pe treaba !!!

http://www.viespar.ro/?reff=ab8e9d8086304d6136eac03c710238d7

Link to comment
Share on other sites

  • 0
7 hours ago, Jamal Alin said:

if(PlayerInfo[playerid][pAdmin] < 5 && vInfo[OwnedVeh(vid)][vLocked] == 1 || !strcmp(vInfo[OwnedVeh(vid)][vOwner], GetName(playerid), false))

Foloseste functia strcmp pentru a face comparatiile respective: https://wiki.sa-mp.com/wiki/Strcmp


if(PlayerInfo[playerid][pAdmin] < 5 && vInfo[OwnedVeh(vid)][vLocked] == 1 || !strcmp(vInfo[OwnedVeh(vid)][vOwner], GetName(playerid), false))

Cam asa trebuie sa arate.

Am incercat si asa dar tot nu merge, nu da erori dar in game nu merge sa urc in masina.

Link to comment
Share on other sites

  • 0
5 hours ago, Cosmarul said:

Am incercat si asa dar tot nu merge, nu da erori dar in game nu merge sa urc in masina.

Sigur nu ai tag atasat la nume ?

Arata-mi si mie functia OwnedVeh(vid)

Incearca si asa:

if(PlayerInfo[playerid][pAdmin] < 5 && vInfo[vid][vLocked] == 1 || !strcmp(vInfo[vid][vOwner], GetName(playerid), false))

Cea mai sigura sursa de facut bani de buzunar in mediul virtual. Inregistreaza-te si pune-te pe treaba !!!

http://www.viespar.ro/?reff=ab8e9d8086304d6136eac03c710238d7

Link to comment
Share on other sites

  • 0
59 minutes ago, Jamal Alin said:

Sigur nu ai tag atasat la nume ?

Arata-mi si mie functia OwnedVeh(vid)

Incearca si asa:

if(PlayerInfo[playerid][pAdmin] < 5 && vInfo[vid][vLocked] == 1 || !strcmp(vInfo[vid][vOwner], GetName(playerid), false))

Nu exista functia OwnedVeh am incercat si cum ai zis tu mai sus si tot nu merge.

Link to comment
Share on other sites

  • 0

Nu stiu ce trebuie sa faca acel OwnedVeh ... nu ai postat tot codul ....

Incearca in loc de strcmp strmatch. Acum am vazut ca ai functii modificate pe acolo ....

Cea mai sigura sursa de facut bani de buzunar in mediul virtual. Inregistreaza-te si pune-te pe treaba !!!

http://www.viespar.ro/?reff=ab8e9d8086304d6136eac03c710238d7

Link to comment
Share on other sites

  • 0
21 minutes ago, Jamal Alin said:

Nu stiu ce trebuie sa faca acel OwnedVeh ... nu ai postat tot codul ....

Incearca in loc de strcmp strmatch. Acum am vazut ca ai functii modificate pe acolo ....

Nici asa nu merge, daca doresti iti dau link de la gm, poate gasesti functia potrivita..

Link to comment
Share on other sites

  • 0

Am gasit:

	if(PlayerInfo[playerid][pAdmin] < 6) 
	{
		if(OwnedVeh(vehicleid) != 0 && vInfo[OwnedVeh(vehicleid)][vLocked] == 1) 
		{
			new Float:cx, Float:cy, Float:cz;
			GetPlayerPos(playerid, cx, cy, cz);
			SetPlayerPos(playerid, cx, cy, cz);
		}
	}

Am adaugat:

if(PlayerInfo[playerid][pAdmin] < 6 || !strcmp(vInfo[OwnedVeh(vehicleid)][vOwner], GetName(playerid), false))

Dar tot nimic.

Link to comment
Share on other sites

  • 0
  • 0
On 26.05.2016 at 21:38, WiDuAlK said:

incearca asa:

Pune stock:

stock IsOwnerVehicle(playerid)
{
    if(strcmp(vInfo[OwnedVeh(vehicleid)][vOwner], GetName(playerid), true) == 0)
    {
        return 1;
    }
    return 0;
}

configureaza-l dupa cum ai tu.

Apoi la verificare pune:


if(PlayerInfo[playerid][pAdmin] < 6 || IsOwnerVehicle(playerid))

Am incercat si asa dar tot nu merge. Scuze ca nu am raspuns mai repede.

Link to comment
Share on other sites

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.