Megaphone Help - 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: Megaphone Help (
/showthread.php?tid=366964)
Megaphone Help -
Luke_James - 08.08.2012
I'm doing a megaphone for my police/medics on my server, and I'm having a little trouble. I want them to only be able to use the megaphone whilst they're in a police car or an ambulance, this is what I've got...
pawn Код:
CMD:m(playerid, text[]) return cmd_megaphone(playerid, text);
CMD:megaphone(playerid, text[])
{
if(PlayerMuteInfo[playerid][AllMuted])
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, " You can't speak, you have been silenced!");
return 1;
}
if(IsACop(playerid))
{
else if(IsAnAmbulance(GetPlayerVehicleID(playerid)))
(
if(!IsPlayerInAnyVehicle(playerid) || !IsAnAmbulance(GetVehicleModel(GetPlayerVehicleID(playerid))) || !IsACopCar(GetVehicleModel(GetPlayerVehicleID(playerid))))
{
SendClientMessage(playerid, COLOR_LIGHTRED, " You are not in a police vehicle!");
return 1;
Re: Megaphone Help -
kaiks - 08.08.2012
I don't really know what you're doing but try this:
pawn Код:
CMD:m(playerid, text[]) return cmd_megaphone(playerid, text);
CMD:megaphone(playerid, text[])
{
if(PlayerMuteInfo[playerid][AllMuted]) return SendClientMessage(playerid, TEAM_CYAN_COLOR, " You can't speak, you have been silenced!");
if(IsACop(playerid) || IsAnAmbulance(GetPlayerVehicleID(playerid)))
{
if(IsAnAmbulance(GetVehicleModel(GetPlayerVehicleID(playerid))) || IsACopCar(GetVehicleModel(GetPlayerVehicleID(playerid))))
{
// Action here
}
else SendClientMessage(playerid, COLOR_LIGHTRED, " You are not in a police vehicle!");
}
return 1;
}
Re: Megaphone Help -
Luke_James - 08.08.2012
Okay, you type /m and a yellow message is sent that says "LSPD - <player message>", or if you're a medic it says "SD-EMS - <player message", it's a megaphone that's used to move traffic or pull somebody over. I want it to be only usable my cops & medics in cop cars/ambulances.
Re: Megaphone Help -
kaiks - 08.08.2012
pawn Код:
CMD:m(playerid, text[]) return cmd_megaphone(playerid, text);
CMD:megaphone(playerid, text[])
{
if(PlayerMuteInfo[playerid][AllMuted]) return SendClientMessage(playerid, TEAM_CYAN_COLOR, " You can't speak, you have been silenced!");
if(IsACop(playerid) || IsAnAmbulance(playerid))
{
if(IsAnAmbulance(GetVehicleModel(GetPlayerVehicleID(playerid))) || IsACopCar(GetVehicleModel(GetPlayerVehicleID(playerid))))
{
new string[128];
format(string, sizeof(string), "[%s: o< %s!]", GetPlayersName(playerid), params);
ProxDetector(20.0, playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
}
else SendClientMessage(playerid, COLOR_LIGHTRED, " You are not in a police vehicle!");
}
return 1;
}
Re: Megaphone Help -
Luke_James - 08.08.2012
I've already got the message strings underneath, as there's 3 different factions that use /m. I just need it to only work for cops/medics and cop cars/ambulances
Re: Megaphone Help -
SuperViper - 08.08.2012
Do you have the actual functions "IsAnAmbulance" and "IsACopCar"?