04.12.2014, 15:45
la idea de este code , seria lo siguiente, pero... -.-.
pawn Код:
//corregido por OTACON :D
#include <a_samp>
#include <zcmd>
#define DIALOG_MEGAPHONE_MENU (10201)
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_RED 0xAA3333AA
enum mega_phone{
megaphoneid,
namemegaphone[128],
}
new MegaphoneSounds[][mega_phone] = {
{ (9605),"Give up. You're surrounded!" },
{ (9612),"We know you're in there!" },
{ (10200),"Hey you! Police. Stop!" },
{ (15800),"This is the Los Santos Police Department; Stay where you are!" },
{ (15801),"Freeze! Or we will open fire" },
{ (15802),"Go! Go! Go!" },
{ (34402),"Police! Don't move!" },
{ (34403),"Get outta the car with your hands in the air!" },
{ (15825),"LSPD. Stop right... are you insane? You'll kill us all!" }
};
COMMAND:megaphone(playerid, params[]){
new data[2][300];
for(new index=0; index<sizeof(MegaphoneSounds); index++){
if(index==0) {format(data[1], 100, "{FFFFFF}%s\n", MegaphoneSounds[index][namemegaphone]);}
else if(index>=1) {format(data[1], 100, "%s{FFFFFF}%s\n", MegaphoneSounds[index][namemegaphone]);}
strcat(data[0], data[1]);
}
ShowPlayerDialog(playerid, DIALOG_MEGAPHONE_MENU, DIALOG_STYLE_LIST, "Megaphone Menu", data[0], "Play", "Cancel");
return true;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
switch(dialogid){
case DIALOG_MEGAPHONE_MENU:{
if(response){
for(new index=0; index<sizeof(MegaphoneSounds); index++){
if(index == listitem){
new Float:pos[4], data[200];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
PlaySoundEx(MegaphoneSounds[index][megaphoneid], pos[0], pos[1], pos[2], 15);
format(data, sizeof(data), "*MEGAPHONE* %s", MegaphoneSounds[index][namemegaphone]);
ProxDetector(15.0, playerid, data, COLOR_RED);
}
}
}else{SendClientMessage(playerid, COLOR_WHITE, "Cancel");}
}
}
return false;
}
stock ProxDetector(Float:radi, playerid, const text[], color){
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
for(new i=0; i<GetMaxPlayers(); i++){
if(!IsPlayerConnected(i))continue;
if(IsPlayerInRangeOfPoint(i,radi,x,y,z)){
SendClientMessage(i,color,text);
}
}
}
stock PlaySoundEx(soundid, Float:x, Float:y, Float:z, Float:radi){
for(new i=0; i<GetMaxPlayers(); i++){
if(!IsPlayerConnected(i))continue;
if(!IsPlayerInRangeOfPoint(i, radi, x, y, z))continue;
PlayerPlaySound(i, soundid, 0, 0, 0);
}
}