SA-MP Forums Archive
/m(egaphone) problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /m(egaphone) problem (/showthread.php?tid=394814)



/m(egaphone) problem - razor steven - 24.11.2012

Hello everyone,
I was having problem with the /megaphone command for LSPD, FBI and NG.

It was supposed to work while Inisde any of these vehicles but only works for LSPD. It doesn't work in NG and FBI vehicle.

Here is the code,
Код:
CMD:m(playerid, params[])
{
	new string[128];
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsACop(playerid) && !IsANG(playerid) && !IsAFBI(playerid) && !IsASSA(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an Leo Officer.");
	if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/m)egaphone [text]");
	if(AntiAdv(playerid, params)) return 1;
	if(!IsLeoVehicle(GetPlayerVehicleID(playerid) && !IsNGVehicle (GetPlayerVehicleID(playerid) && !IsFBIVehicle (GetPlayerVehicleID(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must be in an LEO vehicle to use the megaphone.");
    format(string, sizeof(string), "[%s:o< %s]", RPN(playerid), params);
	SendNearbyMessage(playerid, 40, string, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW);
	return 1;
}
I need help.


Re: /m(egaphone) problem - Glad2BeHere - 24.11.2012

show me isLeoVehicle, stock/or public w/e the code is for "isLeoVehicle"


Re: /m(egaphone) problem - razor steven - 24.11.2012

Код:
 else if(IsLeoVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 1)
	    {
		    new Float:pos[3];
		    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SendClientMessage(playerid, COLOR_ORANGE, " This vehicle is restricted to the LSPD faction.");
	    }
Код:
else if(IsFBIVehicle(vehicleid) && PlayerInfo[playerid][pFac] != 6)
	    {
		    new Float:pos[3];
		    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
		    SendClientMessage(playerid, COLOR_ORANGE, " This vehicle is restricted to the FBI faction.");
	    }



Re: /m(egaphone) problem - Glad2BeHere - 24.11.2012

wrong codes man i said the code for isaleovehicle that means the stock!


Re: /m(egaphone) problem - razor steven - 24.11.2012

Sorry man here you go!
Код:
stock IsLeoVehicle(vehicleid)
{
	for(new i=0; i<26; i++)
	{
	    if(vehicleid == FacInfo[1][fCars][i]) return 1;
	}
	return 0;
}

stock IsNGVehicle(vehicleid)
{
	for(new i=0; i<26; i++)
	{
	    if(vehicleid == FacInfo[7][fCars][i]) return 1;
	}
	return 0;
}

stock IsFBIVehicle(vehicleid)
{
	for(new i=0; i<26; i++)
	{
	    if(vehicleid == FacInfo[6][fCars][i]) return 1;
	}
	return 0;
}



Re: /m(egaphone) problem - Glad2BeHere - 24.11.2012

pawn Код:
!IsLeoVehicle(GetPlayerVehicleID(playerid) || !IsNGVehicle (GetPlayerVehicleID(playerid) || !IsFBIVehicle (GetPlayerVehicleID(playerid)



Re: /m(egaphone) problem - razor steven - 25.11.2012

I now have this error,
Код:
\gamemodes\SRP.pwn(5454) : error 001: expected token: ",", but found "return"
Script line.
Код:
if(!IsLeoVehicle(GetPlayerVehicleID(playerid) || !IsNGVehicle (GetPlayerVehicleID(playerid) || !IsFBIVehicle (GetPlayerVehicleID(playerid) return SendClientMessage(playerid, COLOR_GREY, "You must be in an LEO vehicle to use the megaphone.");



Re: /m(egaphone) problem - Glad2BeHere - 25.11.2012

pawn Код:
if(!IsLeoVehicle(GetPlayerVehicleID(playerid) || !IsNGVehicle (GetPlayerVehicleID(playerid) || !IsFBIVehicle (GetPlayerVehicleID(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must be in an LEO vehicle to use the megaphone.");



Re: /m(egaphone) problem - razor steven - 25.11.2012

It shows the same error.


Re: /m(egaphone) problem - Glad2BeHere - 25.11.2012

pawn Код:
if(!IsLeoVehicle(GetPlayerVehicleID(playerid) || !IsNGVehicle(GetPlayerVehicleID(playerid) || !IsFBIVehicle(GetPlayerVehicleID(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must be in an LEO vehicle to use the megaphone.");
It is different trust me