[REP+] somehow i cant get this randomsongs fixed with enums...
#1

hey guys,
i cant get this fixed... i dont know what im doing wrong but pls can someone help me?

i want it that when a player enters a car the random song gets played and that works.
but now i also have made it that it says which song gets played but somehow it gives me this errors/warnings:
Код:
D:\Program Files\[0.3d]my own drifting gamemode\filterscripts\test.pwn(15) : warning 228: length of initialler exceeds size of the enum field
D:\Program Files\[0.3d]my own drifting gamemode\filterscripts\test.pwn(15) : error 018: initialization data exceeds declared size
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
this are my codes:
pawn Код:
enum Songs
{
    song,
    Name[50]
}
new RandomSongs[][Songs] =
{
    {"http://solidfiles.com/d/1c15bb77bb/download/", "Gangstas Paradise"},
    {"http://solidfiles.com/d/c87f81efc1/download/", "Avicci Levels"},
    {"http://solidfiles.com/d/8c7cbd8004/download/", "Taio Cruz ft Flo Rida - Hangover"},
    {"http://solidfiles.com/d/b1fe05bfe3/download/", "Stereo Hearts - Gym Class Heroes"},
    {"http://solidfiles.com/d/82205e1391/download/", "The one that got away"},
    {"http://solidfiles.com/d/ea0987e81f/download/", "David Guetta - Turn me on"},
    {"http://solidfiles.com/d/54847bc440/download/", "We Found Love"},
    {"http://solidfiles.com/d/c6088a8bba/download/", "Carifornia Love - 2Pac"},
    {"http://solidfiles.com/d/9793382ec9/download/", "Eminem - No Love"},
    {"http://solidfiles.com/d/53ab84e71a/download/", "Eminem - Drop The world"},
    {"http://solidfiles.com/d/5f64502a28/download/", "Amr Diab - Banadeek taala"}, // amr diab
    {"http://solidfiles.com/d/c1736e397e/download/", "Akon Freedom"} // freedom akon
};
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
        new take = random(sizeof(RandomSongs));
        PlayAudioStreamForPlayer(playerid, RandomSongs[take][song]);
        SendClientMessage(playerid, COLOR_GREEN, "if you want to listen to another song then type {FF0000}'/radio'");
        SendClientMessage(playerid, COLOR_GREEN, "if you want to stop the radio then type {FF0000}'/stopradio'");
        new string[128];
        format(string, sizeof(string), "Now Playing: %s", RandomSongs[take][Name]);
        SendClientMessage(playerid, COLOR_RED, string);
        return 1;
}
can anyone tell me whats wrong with this?

i already tried"stock const RandomSongs[][Songs]

pls help the one who helps gets REP+

greets niels
Reply
#2

pawn Код:
enum Songs
{
    song[ 50 ],// The first has Chars, so array
    Name[ 50 ]
}
new RandomSongs[ ][ Songs ] =
{
    { "http://solidfiles.com/d/1c15bb77bb/download/", "Gangstas Paradise" },
    { "http://solidfiles.com/d/c87f81efc1/download/", "Avicci Levels" },
    { "http://solidfiles.com/d/8c7cbd8004/download/", "Taio Cruz ft Flo Rida - Hangover" },
    { "http://solidfiles.com/d/b1fe05bfe3/download/", "Stereo Hearts - Gym Class Heroes" },
    { "http://solidfiles.com/d/82205e1391/download/", "The one that got away" },
    { "http://solidfiles.com/d/ea0987e81f/download/", "David Guetta - Turn me on" },
    { "http://solidfiles.com/d/54847bc440/download/", "We Found Love" },
    { "http://solidfiles.com/d/c6088a8bba/download/", "Carifornia Love - 2Pac" },
    { "http://solidfiles.com/d/9793382ec9/download/", "Eminem - No Love" },
    { "http://solidfiles.com/d/53ab84e71a/download/", "Eminem - Drop The world" },
    { "http://solidfiles.com/d/5f64502a28/download/", "Amr Diab - Banadeek taala" }, // amr diab
    { "http://solidfiles.com/d/c1736e397e/download/", "Akon Freedom" } // freedom akon
};

public OnPlayerStateChange( playerid, newstate, oldstate )
{
    new take = random( sizeof( RandomSongs ) );
    PlayAudioStreamForPlayer( playerid, RandomSongs[ take ][ song ] );
    SendClientMessage( playerid, COLOR_GREEN, "if you want to listen to another song then type {FF0000}'/radio'" );
    SendClientMessage( playerid, COLOR_GREEN, "if you want to stop the radio then type {FF0000}'/stopradio'" );
    new string[ 128 ];
    format( string, sizeof( string ), "Now Playing: %s", RandomSongs[ take ][ Name ] );
    SendClientMessage( playerid, COLOR_RED, string );
    return 1;
}
pawn Код:
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase
Reply
#3

yeah works :d thnx dwane hope i can give you rep becuz i have given you rep mroe times but i will try anyways thnx for help
EDIT: yep rep+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)