SA-MP Forums Archive
[Ajuda] /admvcarro nгo funfa - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] /admvcarro nгo funfa (/showthread.php?tid=560494)



/admvcarro nгo funfa - SheraCoca - 28.01.2015

Bem tentei criar um comando /admvcarro para vender os carros vip, quando digito /admvcarro [id carro]
o carro respawna na concessionaria e continua com o mesmo dono

Код:
	}
	if(strcmp(cmd, "/admvcarro", true) == 0 || strcmp(cmd, "/admvc", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			GetPlayerName(playerid, playername, sizeof(playername));
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USE: /admvcarro [Carro id]");
				return 1;
			}
			new vehid = strval(tmp);
			vehid -= totalveiculosc;
			if (JogadorInfo[playerid][pAdmin] >= 1340)
			{
			    if(admtrabalhando[playerid] < 1 && JogadorInfo[playerid][pAdmin] != 1340 && JogadorInfo[playerid][pAdmin] != 1341 && JogadorInfo[playerid][pAdmin] != 1342)
				{
					SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo estб trabalhando! (/trabalhar)");
					return 1;
				}
				CarInfo[vehid][cOwned] = 0;
				strmid(CarInfo[vehid][cOwner], "Dealership", 0, strlen("Dealership"), 999);
				format(string, sizeof(string), "~w~Voce vendeu este veiculo");
				GameTextForPlayer(playerid, string, 10000, 3);
				new rand = random(sizeof(gRandomCarsSpawns));
				CarInfo[vehid][cLocationx] = gRandomCarsSpawns[rand][0];
				CarInfo[vehid][cLocationy] = gRandomCarsSpawns[rand][1];
				CarInfo[vehid][cLocationz] = gRandomCarsSpawns[rand][2];
				CarInfo[vehid][cAngle] = gRandomCarsSpawns[rand][3];
				RemovePlayerFromVehicleEx(playerid);
				DestroyVehicle(vehid+totalveiculosc);
				new carid2 = CreateVehicle(CarInfo[vehid][cModel],CarInfo[vehid][cLocationx],CarInfo[vehid][cLocationy],CarInfo[vehid][cLocationz]+1.0,CarInfo[vehid][cAngle],CarInfo[vehid][cColorOne],CarInfo[vehid][cColorTwo],60000);
				TogglePlayerControllable(playerid, 1);
				CarregarCarros();
				SetVehicleToRespawn(carid2);
				return 1;
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "Vocк nгo tem permissгo para usar esse comando !");
			}
		}
		return 1;



Re: /admvcarro nгo funfa - Hiuship - 28.01.2015

Uma dica.. parece que estas usando o BGL... faz um loop pra identificar qual й o veiculo que o player esta...

PHP код:
                for(new 0sizeof(CarInfo); i++)
                {
                    if(
CarInfo[i][ownedvehicle] == vehid)
                    { 
ai em seguida modificas o veiculo do id 'i'


Re: /admvcarro nгo funfa - SheraCoca - 28.01.2015

Quote:
Originally Posted by Hiuship
Посмотреть сообщение
Uma dica.. parece que estas usando o BGL... faz um loop pra identificar qual й o veiculo que o player esta...

PHP код:
                for(new 0sizeof(CarInfo); i++)
                {
                    if(
CarInfo[i][ownedvehicle] == vehid)
                    { 
ai em seguida modificas o veiculo do id 'i'
nгo estou usando o bgl, sou iniciante estou tentando desbugar essa gm e estudando, pode explicar melhor? onde devo meter o codigo?