[Pomoc] Prepreka


Započeo fetzy, Septembar 02, 2014, 21:31:33 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim: LARP
Detaljan opis problema: Hocu da promenim komandu za dodavanje i unistavanje prepreka tacnije /crb /rrb i /rrball (/prepreka /unistiprepreku /unistisveprepreke) i nasao sam prepreke i dodao sam, promenio sam to sto sam znao :) (posto sam novi u skriptanju i ne znam bas sve da promenim i resio sam da pitam za pomoc ovde)
Dio skripte: Komanda koja je u mojoj skripti (radi):
CMD:prepreka(playerid, params[], help)
{

    if(UlogovanProvera[playerid] == 0) return SCM(playerid,-1,""JCRVENA"ERROR: "SVCRVENA"Moras se ulogovati da bi koristio ovu komandu!");
	if(!Policajac(playerid)) return SendClientMessage(playerid,-1,""JCRVENA"ERROR: "SVCRVENA"Samo clanovi NYPD!");
	if(PolicajacNaDuznosti[playerid] == 0) return SendClientMessage(playerid, -1, ""JCRVENA"ERROR: "SVCRVENA"Niste uzeli znacku(duznost) pa nemozete koristi tu komandu!");
	if(PI[playerid][pRank] < 3) return SCM(playerid, -1, ""JCRVENA"ERROR: "SVCRVENA"Morate biti rank 3+ da bi koristili ovu komandu!");
	new id,Float:A; GetPlayerPos(playerid, X, Y, Z); GetPlayerFacingAngle(playerid, A);
	if(sscanf(params, "i", id))
	{
  SCM(playerid, -1, ""SIVA"USE: "BELA"/prepreka [Prepreke (1-4)]");
		SCM(playerid, -1, "|------------------PREPREKE-----------------|");
		SCM(playerid, -1, ""GLAVNA"(1). "BELA"M - Za Gume");
		SCM(playerid, -1, ""GLAVNA"(2). "BELA"V - Za Gume");
		SCM(playerid, -1, ""GLAVNA"(3). "BELA"Velika Blokada");
		SCM(playerid, -1, ""GLAVNA"(4). "BELA"Obicna Prepreka");
		SCM(playerid, -1, "|------------------------------------------------|");
		return 1;
	}
	if(id == 1)
	{
		if(Prepreka1Kreirana[playerid] == false)
		{
			Prepreka1[playerid] = CreateObject(2899, X+5, Y, Z-0.9, 0.0, 0.0, A+180);
			Prepreka1Kreirana[playerid] = true;
			SCM(playerid, -1, ""GLAVNA"[NY] "BELA"Postavili ste prepreku!");
		}
		else return SCM(playerid, -1, ""JCRVENA"ERROR: "SVCRVENA"Vec imate kreiranu tu prepreku.");
	}
	else if(id == 2)
	{
		if(Prepreka2Kreirana[playerid] == false)
		{
			Prepreka2[playerid] = CreateObject(2892, X+5, Y, Z-1, 0.0, 0.0, A+180);
			Prepreka2Kreirana[playerid] = true;
			SCM(playerid, -1, ""GLAVNA"[NY] "BELA"Postavili ste prepreku!");
		}
		else return SCM(playerid, -1, ""JCRVENA"ERROR: "SVCRVENA"Vec imate kreiranu tu prepreku.");
	}
	else if(id == 3)
	{
		if(Prepreka3Kreirana[playerid] == false)
		{
			Prepreka3[playerid] = CreateObject(981, X+5, Y, Z-0.5, 0.00000000, 0.00000000, 0.00000000);
			Prepreka3Kreirana[playerid] = true;
			SCM(playerid, -1, ""GLAVNA"[NY] "BELA"Postavili ste prepreku!");
		}
		else return SCM(playerid, -1, ""JCRVENA"ERROR: "SVCRVENA"Vec imate kreiranu tu prepreku.");
	}
	else if(id == 4)
	{
		if(Prepreka4Kreirana[playerid] == false)
		{
			Prepreka4[playerid] = CreateObject(1228, X+5, Y, Z-0.5, 0.00000000, 0.00000000, 0.00000000);
			Prepreka4Kreirana[playerid] = true;
			SCM(playerid, -1, ""GLAVNA"[NY] "BELA"Postavili ste prepreku!");
		}
		else return SendClientMessage(playerid, -1, ""JCRVENA"ERROR: "SVCRVENA"Vec imate kreiranu tu prepreku.");
	}
	else return SCM(playerid, -1, ""JCRVENA"ERROR: "SVCRVENA"Pogresan ID prepreke (1-4)!");
	return 1;
}

CMD:unistiprepreku(playerid, params[],help)
{

    if(UlogovanProvera[playerid] == 0) return SCM(playerid,-1,""JCRVENA"ERROR: "SVCRVENA"Moras se ulogovati da bi koristio ovu komandu!");
    if(!Policajac(playerid)) return SendClientMessage(playerid,-1,""JCRVENA"ERROR: "SVCRVENA"Samo clanovi SAPD!");
	if(PolicajacNaDuznosti[playerid] == 0) return SendClientMessage(playerid, -1, ""JCRVENA"ERROR: "SVCRVENA"Niste uzeli znacku(duznost) pa nemozete koristi tu komandu!");
	new id;
	if(sscanf(params, "i", id)) return SCM(playerid,-1, ""SIVA"USE: "BELA"/unistiprepreku [Prepreke (1-4)]");
	if(id == 1)
	{
		if(Prepreka1Kreirana[playerid] == true)
		{
			DestroyObject(Prepreka1[playerid]);
			SCM(playerid, -1, ""GLAVNA"[NY] "BELA"Unistili ste prepreku!");
			Prepreka1Kreirana[playerid] = false;
		}
		else return SendClientMessage(playerid, -1, ""JCRVENA"ERROR: "SVCRVENA"Ta prepreka nije kreirana!");
	}
	else if(id == 2)
	{
		if(Prepreka2Kreirana[playerid] == true)
		{
			DestroyObject(Prepreka2[playerid]);
			SCM(playerid, -1, ""GLAVNA"[NY] "BELA"Unistili ste prepreku!");
			Prepreka2Kreirana[playerid] = false;
		}
		else return SendClientMessage(playerid, -1, ""JCRVENA"ERROR: "SVCRVENA"Ta prepreka nije kreirana!");
	}
	else if(id == 3)
	{
		if(Prepreka3Kreirana[playerid] == true)
		{
			DestroyObject(Prepreka3[playerid]);
			SCM(playerid, -1, ""GLAVNA"[NY] "BELA"Unistili ste prepreku!");
			Prepreka3Kreirana[playerid] = false;
		}
		else return SendClientMessage(playerid, -1, ""JCRVENA"ERROR: "SVCRVENA"Ta prepreka nije kreirana!");
	}
	else if(id == 4)
	{
		if(Prepreka4Kreirana[playerid] == true)
		{
			DestroyObject(Prepreka4[playerid]);
			SCM(playerid, -1, ""GLAVNA"[NY] "BELA"Unistili ste prepreku!");
			Prepreka4Kreirana[playerid] = false;
		}
		else return SendClientMessage(playerid, -1, ""JCRVENA"ERROR: "SVCRVENA"Ta prepreka nije kreirana!");
	}
	else return SCM(playerid, -1, ""JCRVENA"ERROR: "SVCRVENA"Pogresan ID prepreke!");
	return 1;
}

CMD:unistisveprepreke(playerid, params[], help)
{

    if(UlogovanProvera[playerid] == 0) return SCM(playerid,-1,""JCRVENA"ERROR: "SVCRVENA"Moras se ulogovati da bi koristio ovu komandu!");
	if(PI[playerid][pLider] != 1) return SendClientMessage(playerid,-1,""JCRVENA"ERROR: "SVCRVENA"Samo lider SAPD!");
	if(PolicajacNaDuznosti[playerid] == 0) return SendClientMessage(playerid, -1, ""JCRVENA"ERROR: "SVCRVENA"Niste uzeli znacku(duznost) pa nemozete koristi tu komandu!");
	foreach(Player,i)
	{
		DestroyObject(Prepreka1[i]);
		DestroyObject(Prepreka2[i]);
		DestroyObject(Prepreka3[i]);
		DestroyObject(Prepreka4[i]);
		Prepreka1Kreirana[i] = false;
		Prepreka2Kreirana[i] = false;
		Prepreka3Kreirana[i] = false;
		Prepreka4Kreirana[i] = false;
	}
	SCM(playerid,-1,""GLAVNA"[NY] "BELA"Unistili ste sve potavljene prepreke!");
	new string[128];
	format(string, sizeof(string),""GLAVNA"[NY] "BELA"Sve prepreke NYPD-a je unistio %s!",GetName(playerid));
	SCMTA(-1,string);
	return 1;
}

Komanda koja sam izmenio i sad nece da radi..
if(strcmp(cmd, "/crb", true) == 0 || strcmp(cmd, "/createroadblock", true) == 0)
	{
	    if(IsPlayerConnected(playerid) && IsACop(playerid) || IsPlayerAdmin(playerid))
     	{
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "Koriscenje: /crb [Roadblock ID]");
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "Available Roadblocks:");
				SendClientMessage(playerid, COLOR_GRAD1, "| 1: Small Roadblock | 2: Medium Roadblock |");
				SendClientMessage(playerid, COLOR_GRAD1, "| 3: Big Roadblock | 4: Cone | 5: Detour Sign |");
				SendClientMessage(playerid, COLOR_GRAD1, "| 6: Will Be Sign | 7: Line Closed Sign |");
				return 1;
			}
            new rb = strval(tmp);
            if (rb == 1)
			{
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
		        GetPlayerPos(playerid, plocx, plocy, plocz);
		        GetPlayerFacingAngle(playerid,ploca);
		        CreateRoadblock(1459,plocx,plocy,plocz,ploca);
		        format(string,sizeof(string),"[HQ]: Officer %s has placed a Roadblock(1) at his position, over.",sendername);
		        SendRadioMessage(1,COLOR_BLUE,string);
		        GameTextForPlayer(playerid,"~w~Roadblock ~b~Placed!",3000,1);
				return 1;
			}
			else if (rb == 2)
			{
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
		        GetPlayerPos(playerid, plocx, plocy, plocz);
		        GetPlayerFacingAngle(playerid,ploca);
		        CreateRoadblock(978,plocx,plocy,plocz+0.6,ploca);
		        format(string,sizeof(string),"[HQ]: Officer %s has placed a Roadblock(2) at his position, over.",sendername);
		        SendRadioMessage(1,COLOR_BLUE,string);
		        GameTextForPlayer(playerid,"~w~Roadblock ~b~Placed!",3000,1);
				return 1;
			}
			else if (rb == 3)
			{
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
		        GetPlayerPos(playerid, plocx, plocy, plocz);
		        GetPlayerFacingAngle(playerid,ploca);
		        CreateRoadblock(981,plocx,plocy,plocz+0.9,ploca+180);
		        format(string,sizeof(string),"[HQ]: Officer %s has placed a Roadblock(3) at his position, over.",sendername);
		        SendRadioMessage(1,COLOR_BLUE,string);
		        GameTextForPlayer(playerid,"~w~Roadblock ~g~Placed!",3000,1);
		        SafeSetPlayerPos(playerid, plocx, plocy+1.3, plocz);
				return 1;
			}
			else if (rb == 4)
			{
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
		        GetPlayerPos(playerid, plocx, plocy, plocz);
		        GetPlayerFacingAngle(playerid,ploca);
		        CreateRoadblock(1238,plocx,plocy,plocz+0.2,ploca);
		        format(string,sizeof(string),"[HQ]: Officer %s has placed a Traffic Cone(1) at his position, over.",sendername);
		        SendRadioMessage(1,COLOR_BLUE,string);
		        GameTextForPlayer(playerid,"~w~Cone ~g~Placed!",3000,1);
				return 1;
			}
			else if (rb == 5)
			{
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
		        GetPlayerPos(playerid, plocx, plocy, plocz);
		        GetPlayerFacingAngle(playerid,ploca);
		        CreateRoadblock(1425,plocx,plocy,plocz+0.6,ploca);
		        format(string,sizeof(string),"[HQ]: Officer %s has placed a Detour Sign(4) at his position, over.",sendername);
		        SendRadioMessage(1,COLOR_BLUE,string);
		        GameTextForPlayer(playerid,"~w~Sign ~g~Placed!",3000,1);
				return 1;
			}
			else if (rb == 6)
			{
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
		        GetPlayerPos(playerid, plocx, plocy, plocz);
		        GetPlayerFacingAngle(playerid,ploca);
		        CreateRoadblock(3265,plocx,plocy,plocz-0.5,ploca);
		        format(string,sizeof(string),"[HQ]: Officer %s has placed a Will Be Sign(5) at his position, over.",sendername);
		        SendRadioMessage(1,COLOR_BLUE,string);
		        GameTextForPlayer(playerid,"~w~Sign ~g~Placed!",3000,1);
				return 1;
			}
			else if (rb == 7)
			{
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
		        GetPlayerPos(playerid, plocx, plocy, plocz);
		        GetPlayerFacingAngle(playerid,ploca);
		        CreateRoadblock(3091,plocx,plocy,plocz+0.5,ploca+180);
		        format(string,sizeof(string),"[HQ]: Officer %s has placed a Line Closed Sign(6) at his position, over.",sendername);
		        SendRadioMessage(1,COLOR_BLUE,string);
		        GameTextForPlayer(playerid,"~w~Sign ~g~Placed!",3000,1);
				return 1;
			}
			new y, m, d;
			new h,mi,s;
			getdate(y,m,d);
			gettime(h,mi,s);
			format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /createroadblock %d",d,m,y,h,mi,s,sendername, rb);
			CommandLog(string);
		}
	    return 1;
	}

	if (strcmp(cmd,"/rub",true) == 0 || strcmp(cmd, "/removeroadblock", true) == 0)
	{
	    if(IsPlayerConnected(playerid) && IsACop(playerid) || PlayerInfo[playerid][pAdmin] >= 2)
     	{
        	DeleteClosestRoadblock(playerid);
        	format(string,sizeof(string),"[HQ]: Officer %s has removed a Roadblock, over.",sendername);
	        SendRadioMessage(1,COLOR_BLUE,string);
	        GameTextForPlayer(playerid,"~w~Roadblock ~r~Removed!",3000,1);
	        new y, m, d;
			new h,mi,s;
			getdate(y,m,d);
			gettime(h,mi,s);
			format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /removeroadblock",d,m,y,h,mi,s,sendername);
			CommandLog(string);
		}
	    return 1;
	}

	if (strcmp(cmd,"/rrball",true) == 0 || strcmp(cmd, "/removeroadblockall", true) == 0)
	{
	    if(IsPlayerConnected(playerid) && IsACop(playerid)  || PlayerInfo[playerid][pAdmin] >= 2)
     	{
			if(PlayerInfo[playerid][pRank] >= 5 || PlayerInfo[playerid][pAdmin] >= 2) // This being the default Chief rank in LA-RP change if neccesary.
			{
        		DeleteAllRoadblocks(playerid);
        		format(string,sizeof(string),"[HQ]: Officer %s has removed all Roadblocks in the area, over.",sendername);
	        	SendRadioMessage(1,COLOR_BLUE,string);
	        	GameTextForPlayer(playerid,"~b~All ~w~Roadblocks ~r~Removed!",3000,1);
	        	new y, m, d;
				new h,mi,s;
				getdate(y,m,d);
				gettime(h,mi,s);
				format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /removeroadblockall",d,m,y,h,mi,s,sendername);
				CommandLog(string);
			}
		}
	    return 1;
	}

Neke slike/video za lakse dobivanje pomoci(neobavezno):

Cekaj ti hoces da ove komande iz ZCMD prebacis u strcmp ako sam najbolje razumeo ?
Poslednja Izmena: Septembar 04, 2014, 03:08:18 PRE PODNE od â–… â–† â–ˆ Rudimental â–ˆ â–† â–…

Citat: â–... â–† â–ˆ Rudimental â–ˆ â–† â–... poslato Septembar 04, 2014, 03:07:35 PRE PODNE
Cekaj ti hoces da ove komande iz ZCMD prebacis u strcmp ako sam najbolje razumeo ?
Ovu komandu iz strcmp hocu da je prebacim u ZCMD :)