for(new w1 = 0; w1 < sizeof(MegaphoneSounds); w1++)
if(dialogid == DIALOG_MEGAPHONE_MENU) { if(!response) return SCM(playerid, COLOR_WHITE, "Cancel"); new soundid, tw1 = 0; for(new w1 = 0; w1 < sizeof(MegaphoneSounds); w1++) { if(tw1 != listitem) { tw1++; continue; } new tmp1[2][128]; split(MegaphoneSounds[w1], tmp1, ','); soundid = strval(tmp1[0]); break; } new Float:pos[4]; GetPlayerPos(playerid, pos[0], pos[1], pos[2]); PlaySoundEx(soundid, pos[0], pos[1], pos[2], 15); return 1; } return 0; }
(12524) : error 017: undefined symbol "MegaphoneSounds" (12524) : error 036: empty statement (12524) : error 017: undefined symbol "w1" (12524) : fatal error 107: too many error messages on one line
#define MegaphoneSounds 16//o el numero que tengas definido
for(new w1 = 0; w1 < MegaphoneSounds; w1++)
Obviamente no tienes definido el Mega... Pon new MegaphoneSounds[128]; (Por ejemplo). En lo de w1, quita ese 1 y deja sola la w. for(new w=... |
#define MegaphoneSounds 16//o el numero que tengas definido for(new w1 = 0; w1 < MegaphoneSounds; w1++)
: error 029: invalid expression, assumed zero : error 029: invalid expression, assumed zero : warning 215: expression has no effect : error 001: expected token: ";", but found "]" : fatal error 107: too many error messages on one line
Hice lo que usted me dijo y me aparecio esto :
: error 017: undefined symbol "w1" : error 020: invalid symbol name "" : error 036: empty statement : fatal error 107: too many error messages on one line Код:
#define MegaphoneSounds 16//o el numero que tengas definido for(new w1 = 0; w1 < MegaphoneSounds; w1++) Ahora me tira un error en esta linea : split(MegaphoneSounds[w1], tmp1, ','); Код:
: error 029: invalid expression, assumed zero : error 029: invalid expression, assumed zero : warning 215: expression has no effect : error 001: expected token: ";", but found "]" : fatal error 107: too many error messages on one line |
split(w1, tmp1, ',');
//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);
}
}