Jump to content
  • 0

Problema /v


Mariusik[]

Question

Deci am facut comanda /v pe dialog, cand dau sa se spawneze una din masini le spawneaza pe  toate 4 sau cate masini am pe numele meu, cum fac sa nu se mai spawneze toate o data, adica cand selectez prima masina toate setarile sa se executa la ea nu la toate 4 sau cate am.

Link to comment
Share on other sites

14 answers to this question

Recommended Posts

  • 0
Acum 17 ore, Mister a spus:

posteaza dialogul 

case DIALOG_VEHICLES+1:
		{
			if(listitem == 0) // Info car
			{
				ShowPlayerDialog(playerid, DIALOG_VEHICLES+1, DIALOG_STYLE_MSGBOX, "{FFFFFF}Informatii Masina", "Test", "OK", "");
			}
			if(listitem == 1)
			{
				ShowPlayerDialog(playerid, DIALOG_VEHICLES+2, DIALOG_STYLE_MSGBOX, "{FFFFFF}Spawn/Despawn", "{FFFFFF}Pentru a spawna masina pe server apa SPAW\nDaca vrei sa ascunzi masina apasa pe DESPAWN.", "SPAWN", "DESPAWN");
			}
		}
		case DIALOG_VEHICLES+2:
		{
			if(response) // spawn
			{
				new id = 0;
				for(new i = 0; i <= Total_Veh_Created; i++)
				{
					new gString[200];
					if(strmatch(vInfo[i][vOwner], GetName(playerid)))
					{
						if(IsVehSpawned(i) == 1) return SendClientMessage(playerid, COLOR_ERROR, "Aceasta masina este spawnata.");
						SpawnVeh(playerid, i);
						format(gString, sizeof(gString), "Masina de tip %s s-a spawnat.", VehicleNames[vInfo[i][vModel]-400]);
						SendClientMessage(playerid, COLOR_ERROR, gString);
						id++;
					}
				}
			}
			if(!response) // Despawn
			{
				new id = 0;
				for(new i = 0; i <= Total_Veh_Created; i++)
				{
					new gString[200];
					if(strmatch(vInfo[i][vOwner], GetName(playerid)))
					{
						if(IsVehSpawned(i) == 0) return SendClientMessage(playerid, COLOR_ERROR, "Aceasta masina este ascunsa.");
						DespawnVeh(playerid);
						format(gString, sizeof(gString), "Masina de tip %s s-a despawnat.", VehicleNames[vInfo[i][vModel]-400]);
						SendClientMessage(playerid, COLOR_ERROR, gString);
						id++;
					}
				}
			}
		}

 

Link to comment
Share on other sites

  • 0

tu ai si la response si la daca nu da response sa se spawneze toate masinile

Adauga functia asta in gm 

getvehslot(playerid,slot)
{
	new counth=0;
	for(new i = 0; i <= Total_Veh_Created; i++)
	{
		new gString[200];
		if(strmatch(vInfo[i][vOwner], GetName(playerid)))
		{
        	counth++;
		    if(counth==slot)
		    return i;
		    
		}
	}
	return -1;
}

Iar la dialog modifici in asta

			if(response) // spawn
			{
				new id = getvehslot(playerid,listitem+1);
				new gString[200];
				if(IsVehSpawned(id) == 1) return SendClientMessage(playerid, COLOR_ERROR, "Aceasta masina este spawnata.");
				SpawnVeh(playerid, id);
				format(gString, sizeof(gString), "Masina de tip %s s-a spawnat.", VehicleNames[vInfo[id][vModel]-400]);
				SendClientMessage(playerid, COLOR_ERROR, gString);
			}

EDIT am omis ceva

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0
Acum 12 minute, Mister a spus:

tu ai si la response si la daca nu da response sa se spawneze toate masinile

Adauga functia asta in gm 


getvehslot(playerid,slot)
{
	new counth=0;
	for(new i = 0; i <= Total_Veh_Created; i++)
	{
		new gString[200];
		if(strmatch(vInfo[i][vOwner], GetName(playerid)))
		{
        	counth++;
		    if(counth==slot)
		    return i;
		    
		}
	}
	return -1;
}

Iar la dialog modifici in asta


			if(response) // spawn
			{
				new id = getvehslot(playerid,listitem+1);
				new gString[200];
				if(IsVehSpawned(id) == 1) return SendClientMessage(playerid, COLOR_ERROR, "Aceasta masina este spawnata.");
				SpawnVeh(playerid, id);
				format(gString, sizeof(gString), "Masina de tip %s s-a spawnat.", VehicleNames[vInfo[id][vModel]-400]);
				SendClientMessage(playerid, COLOR_ERROR, gString);
			}

EDIT am omis ceva

nu executa abosult nmk

EDIT: nici daca modific for(new i = 1; i <= Total_Veh_Created; i++)

Edited by Anonim69
Link to comment
Share on other sites

  • 0

Din ce am vazut mai sus ai dialogul unde nu trebuie la comanda de /v sau cum ai tu, acolo tu arati un dialog cu fiecare masina iar dialogul modificat de mine trebuie sa aiba idul aceluia

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0
Acum 1 minut, Mister a spus:

Din ce am vazut mai sus ai dialogul unde nu trebuie la comanda de /v sau cum ai tu, acolo tu arati un dialog cu fiecare masina iar dialogul modificat de mine trebuie sa aiba idul aceluia

eu cand dau spawn, nu apare nici masina si nici un text..

Link to comment
Share on other sites

  • 0
CMD:v(playerid, parms[])
{
	new Title[200], string[256], string1[700];
	format(Title, sizeof(Title), "Garajul lui %s - (%d sloturi)",GetName(playerid), PlayerData[playerid][pCarSlot]);
	new coordsstring[64] = "Nume\tStatus\tTip Masina\n";
	if(GetVehNumber(playerid) == 0)
	{
		return SendClientMessage(playerid,COLOR_ERROR,"Nu ai masini personale.");
	}
	else
	{
	    for(new i = 0; i <= Total_Veh_Created; i++)
		{
			new type[20];
			if(vInfo[i][vType] == 0)
			{
				type = "{FFFFFF}Tutorial";
			}
			else if(vInfo[i][vType] == 1)
			{
				type = "{FFFFFF}Normal";
			}
			else if(vInfo[i][vType] == 2)
			{
				type = "{FFB870}Premium";
			}
			else if(vInfo[i][vType] == 3)
			{
				type = "{FFB870}Shop";
			}
			if(strmatch(vInfo[i][vOwner], GetName(playerid)))
			{
				if(IsVehSpawned(i) == 1) format(string, sizeof(string), "{FFFFFF}%s\t{33AA33}Spawnat{FFFFFF}\t%s\n",VehicleNames[vInfo[i][vModel] - 400], type);
				else format(string, sizeof(string), "{FFFFFF}%s\t{E60000}Ascuns{FFFFFF}\t%s\n",VehicleNames[vInfo[i][vModel] - 400], type);
				strcat(string1, string);
			}
		}
		strins(string1, coordsstring, 0);
		ShowPlayerDialog(playerid, DIALOG_VEHICLES, DIALOG_STYLE_TABLIST_HEADERS, Title, string1, "Selecteaza", "Iesi");
	}
	return 1;
}

 

Link to comment
Share on other sites

  • 0

Bun tu ar trebui sa adaugi codul acesta la 

DIALOG_VEHICLES
if(response) // spawn
			{
				new id = getvehslot(playerid,listitem+1);
				new gString[200];
				if(IsVehSpawned(id) == 1) return SendClientMessage(playerid, COLOR_ERROR, "Aceasta masina este spawnata.");
				SpawnVeh(playerid, id);
				format(gString, sizeof(gString), "Masina de tip %s s-a spawnat.", VehicleNames[vInfo[id][vModel]-400]);
				SendClientMessage(playerid, COLOR_ERROR, gString);
			}

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0
Acum 7 minute, Mister a spus:

Bun tu ar trebui sa adaugi codul acesta la 


DIALOG_VEHICLES

if(response) // spawn
			{
				new id = getvehslot(playerid,listitem+1);
				new gString[200];
				if(IsVehSpawned(id) == 1) return SendClientMessage(playerid, COLOR_ERROR, "Aceasta masina este spawnata.");
				SpawnVeh(playerid, id);
				format(gString, sizeof(gString), "Masina de tip %s s-a spawnat.", VehicleNames[vInfo[id][vModel]-400]);
				SendClientMessage(playerid, COLOR_ERROR, gString);
			}

pai eu vreau sa fac ca la DIALOG_vEHICLES sa fie meniul cu functile (spawn/despawn, tow, bla bla si pentru fiecare dintre ele sa fac separat).

 

EDIT: Cum zici tu

Edited by Anonim69
Link to comment
Share on other sites

  • 0

Eu asta am inteles ca vrei sa faci din ce ai cerut, functia merge adapteaza pentru dialogul in care ai functiile fiecarui vehicul

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0

@Mister

			if(listitem == 2)
			{
				new id = getvehslot(playerid,listitem+1);
				new gString[200];
				if(IsVehSpawned(id) == 0) return SendClientMessage(playerid, COLOR_ERROR, "Aceasta masina este ascunsa.");
				vInfo[OwnedVeh(id)][vSpawned] = 0;
				vUpdate(OwnedVeh(id), vSpawnedx);
				vInfo[OwnedVeh(id)][vFuel] = Fuel[id];
				vUpdate(OwnedVeh(id), vFuelx);
				vUpdate(OwnedVeh(id), vKmx);
				OwnedVeh(id) = 0;
				DestroyVehicle(id);
				format(gString, sizeof(gString), "Masina de tip %s s-a despawnat.", VehicleNames[vInfo[id][vModel]-400]);
				SendClientMessage(playerid, COLOR_ERROR, gString);
			}

Vreo idee dc nu o executa? P.S: apare textul ca masina este ascunsa

Edited by Anonim69
Link to comment
Share on other sites

  • 0

La dialogul de vehicule trebuie sa faci o variabila sa se atribui listitem+1 iar apoi aici unde ai tu aceasta functie getvehslot sa fie apelata acea variabila gen adauga in gm new vehslot[MAX_PLAYERS];

iar la dialogul dialog_vehicles atribui

vehslot[playerid] = listitem+1;

iar la 

new id = getvehslot(playerid,vehslot [playerid]);

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0
Acum 4 minute, Mister a spus:

La dialogul de vehicule trebuie sa faci o variabila sa se atribui listitem+1 iar apoi aici unde ai tu aceasta functie getvehslot sa fie apelata acea variabila gen adauga in gm new vehslot[MAX_PLAYERS];

iar la dialogul dialog_vehicles atribui

vehslot[playerid] = listitem+1;

iar la 


new id = getvehslot(playerid,vehslot [playerid]);

Multumesc mult pentru ajutor, poti da T/C

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.