[Pomoc] /megaphone

Započeo David003, Januar 21, 2013, 20:22:02 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim: CSRP (moja)
Opis problema: Napravio sam komandu /megaphone i sve radi ali kako da stavim da samo kad je u vozilo da se moze koristit
Dio skripte:
if(strcmp(cmd, "/megaphone", true) == 0 || strcmp(cmd, "/m", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			new tmpcar = GetPlayerVehicleID(playerid);
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[128];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "Koriscenje: (/m)egaphone [megaphone chat]");
				return 1;
			}
			if(gTeam[playerid] == 2 || IsACop(playerid))
            {
				if(!IsACopCar(tmpcar))
				{
					if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
					{
					    new currank[64];
    					if(PlayerInfo[playerid][pRank] == 1) { currank = "PD.Kadet"; }
						else if(PlayerInfo[playerid][pRank] == 2) { currank = "PD.Policajac"; }
						else if(PlayerInfo[playerid][pRank] == 3) { currank = "PD.Narednik"; }
						else if(PlayerInfo[playerid][pRank] == 4) { currank = "PD.Inspektor"; }
						else if(PlayerInfo[playerid][pRank] == 5) { currank = "PD.Porucnik"; }
						else if(PlayerInfo[playerid][pRank] == 6) { currank = "PD.Nacelnik "; }
						else { currank = "PD.Kadet"; }
						format(string, sizeof(string), "[%s %s:o< %s]", currank, sendername, result);
						ProxDetector(60.0, playerid, string,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
					}
					else if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2)
					{
						format(string, sizeof(string), "[Agent %s:o< %s]", sendername, result);
						ProxDetector(60.0, playerid, string,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
					}
					else if(PlayerInfo[playerid][pMember] == 3||PlayerInfo[playerid][pLeader] == 3)
					{
						format(string, sizeof(string), "[Casnik %s:o< %s]", sendername, result);
						ProxDetector(60.0, playerid, string,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
					}
					printf("%s", string);
				}
				else
				{
				    SendClientMessage(playerid, COLOR_GRAD2, "   Niste u policajskom vozilu!");
				    return 1;
				}
            }
			else
			{
			    SendClientMessage(playerid, COLOR_GRAD2, "Niste clan Tima!");
				return 1;
			}
		}
		return 1;
	}


Slika/Video: //

Uskoro!
Usput trazim mapera,inbox zainteresirani!

probaj vako
if(strcmp(cmd, "/megaphone", true) == 0 || strcmp(cmd, "/m", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			new tmpcar = GetPlayerVehicleID(playerid);
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[128];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "Koriscenje: (/m)egaphone [megaphone chat]");
				return 1;
			}
			if(gTeam[playerid] == 2 || IsACop(playerid))
            {
				
					if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
					{
					    new currank[64];
    					if(PlayerInfo[playerid][pRank] == 1) { currank = "PD.Kadet"; }
						else if(PlayerInfo[playerid][pRank] == 2) { currank = "PD.Policajac"; }
						else if(PlayerInfo[playerid][pRank] == 3) { currank = "PD.Narednik"; }
						else if(PlayerInfo[playerid][pRank] == 4) { currank = "PD.Inspektor"; }
						else if(PlayerInfo[playerid][pRank] == 5) { currank = "PD.Porucnik"; }
						else if(PlayerInfo[playerid][pRank] == 6) { currank = "PD.Nacelnik "; }
						else { currank = "PD.Kadet"; }
						format(string, sizeof(string), "[%s %s:o< %s]", currank, sendername, result);
						ProxDetector(60.0, playerid, string,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
					}
					else if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2)
					{
						format(string, sizeof(string), "[Agent %s:o< %s]", sendername, result);
						ProxDetector(60.0, playerid, string,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
					}
					else if(PlayerInfo[playerid][pMember] == 3||PlayerInfo[playerid][pLeader] == 3)
					{
						format(string, sizeof(string), "[Casnik %s:o< %s]", sendername, result);
						ProxDetector(60.0, playerid, string,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
					}
					printf("%s", string);

            }
			else
			{
			    SendClientMessage(playerid, COLOR_GRAD2, "Niste clan Tima!");
				return 1;
			}
		}
		return 1;
	}
Pravim RP,DM,TDM,STUNT, Freeroam modove od 0 za pare, nacini placanja : Paypal ili banka

Radi,jedino sto sad dobivam ovaj warning

C:\Users\David\Desktop\Croatia Sky RolePlay\gamemodes\CSRP.pwn(41477) : warning 204: symbol is assigned a value that is never used: "tmpcar"

Uskoro!
Usput trazim mapera,inbox zainteresirani!

Citat: David (Sabljak) A.k.A SABO(T) poslato Januar 21, 2013, 20:41:52 POSLE PODNE
Tmpcar nisi nigdje koristio nakon new
Koristio sam vise puta

new tmpcar = GetPlayerVehicleID(playerid);


Uskoro!
Usput trazim mapera,inbox zainteresirani!

nepotrebno se mucis, samo stavi da mu returna poruku
if(!IsPlayerInAnyVehicle....//i ovde da mu returna poruku