[Pomoc] Komanda


Započeo []Flynâ„¢, Januar 29, 2011, 03:17:12 PRE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

[]Flynâ„¢

*

Never look down on anybody unless you're helping them up.

Poceo sam prebacivati sve komande u ZCMD, jos uvek ne razumem tako dobro ZCMD pa ako nije problem ko zna da mi neke komande oko kojih budem imao problem uradi(prebaci)Obicno su to komande u kojima moras upisati igracem ID ili /komanda [id] [nesto] ..Evo npr /veh komanda..

Kod: c
if(strcmp(cmd, "/veh", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if (PlayerInfo[playerid][Admin] < 1)
			{
			     SendClientMessage(playerid, COLOR_GRAD1, "Moras biti Admin lvl:1");
			    return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, CRVENA, "Komanda: /veh [VoziloID] [Boja1] [Boja2]");
				return 1;
			}
			new car;
			car = strvalEx(tmp);
			if(car < 400 || car > 611) { SendClientMessage(playerid, SIVA, "Broj auta moze biti izmedu 400 i 611 !"); return 1; }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "KORSITI: /veh [autoID] [boja1] [boja2]");
				return 1;
			}
			new color1;
			color1 = strvalEx(tmp);
			if(color1 < 0 || color1 > 126) { SendClientMessage(playerid, SIVA, "Boja auta moze biti izmedu 1 i 126 !"); return 1; }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, CRVENA, "Komanda: /veh [VoziloID] [Boja1] [Boja2]");
				return 1;
			}
			new color2;
			color2 = strvalEx(tmp);
			if(color2 < 0 || color2 > 126) { SendClientMessage(playerid, SIVA, "Boja auta moze biti izmedu 1 i 126 !"); return 1; }
			new Float:X,Float:Y,Float:Z;
			GetPlayerPos(playerid, X,Y,Z);
			new carid = CreateVehicle(car, X,Y,Z, 0.0, color1, color2, -1);
			CreatedCars[CreatedCar] = carid;
			CreatedCar ++;
			format(string, sizeof(string), "*Vozilo %d je stvoreno*", carid);
			SendClientMessage(playerid, SVETLOPLAVA, string);
			Vehano[carid] = 1;
		}
		return 1;
	}



Kod: c
CMD:veh(playerid, params[])
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if (PlayerInfo[playerid][Admin] < 1)
			{
			     SendClientMessage(playerid, COLOR_GRAD1, "Moras biti Admin lvl:1");
			    return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, CRVENA, "Komanda: /veh [VoziloID] [Boja1] [Boja2]");
				return 1;
			}
			new car;
			car = strvalEx(tmp);
			if(car < 400 || car > 611) { SendClientMessage(playerid, SIVA, "Broj auta moze biti izmedu 400 i 611 !"); return 1; }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "KORSITI: /veh [autoID] [boja1] [boja2]");
				return 1;
			}
			new color1;
			color1 = strvalEx(tmp);
			if(color1 < 0 || color1 > 126) { SendClientMessage(playerid, SIVA, "Boja auta moze biti izmedu 1 i 126 !"); return 1; }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, CRVENA, "Komanda: /veh [VoziloID] [Boja1] [Boja2]");
				return 1;
			}
			new color2;
			color2 = strvalEx(tmp);
			if(color2 < 0 || color2 > 126) { SendClientMessage(playerid, SIVA, "Boja auta moze biti izmedu 1 i 126 !"); return 1; }
			new Float:X,Float:Y,Float:Z;
			GetPlayerPos(playerid, X,Y,Z);
			new carid = CreateVehicle(car, X,Y,Z, 0.0, color1, color2, -1);
			CreatedCars[CreatedCar] = carid;
			CreatedCar ++;
			format(string, sizeof(string), "*Vozilo %d je stvoreno*", carid);
			SendClientMessage(playerid, SVETLOPLAVA, string);
			Vehano[carid] = 1;
		}
		return 1;
	}

[]Flynâ„¢

*

Never look down on anybody unless you're helping them up.

Samo taj prvi red se menja? A kada je sa SSCANFom onda se jos nesx menja..tako?

BloodMaster

*

Ex. Super Moderator

Kod: c
CMD:veh(playerid,params[])
{
new model;
if(Igrac[playerid][pAdmin] < 9) return SendMessage(playerid,"{FFCAFA}Nisi admin! (lvl 9+)");
if(sscanf(params,"i",model)) return SendMessage(playerid,"{F00F00}Koristi: /veh <ID_vozila>");
if(model < 400 || model > 611 ) return SendMessage(playerid,"{FA000C}Id vozila mora biti izmedju 400 i 611!");
new Float:x,Float:y,Float:z,Float:a;
GetPlayerPos(playerid,x,y,z); SetPlayerFacingAngle(playerid,a);
CreateVehicle(model,x,y,z,a,-1,-1,60000);
return 1;
}



I na vrh:

Kod: c
#define SendMessage(%0,%2) SendClientMessage(%0,0xFFFFFFFF,%2)

[]Flynâ„¢

*

Never look down on anybody unless you're helping them up.

E to care.. tNx
Aj mi samo daj definiciju ili sta imas za ovo if(Igrac
Poslednja Izmena: Januar 29, 2011, 12:11:20 POSLE PODNE od joXy

BloodMaster

*

Ex. Super Moderator

Citat: joXy poslato Januar 29, 2011, 12:07:47 POSLE PODNE
E to care.. tNx
Aj mi samo daj definiciju ili sta imas za ovo if(Igrac

omg....

PlayerInfo[playerid][pAdmin] ti stavi