why this is giving error? - 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: why this is giving error? (
/showthread.php?tid=313790)
why this is giving error? -
niels44 - 27.01.2012
hey guys,
i want to make random songs for a player when it enters a vehicle and well i have made this:
pawn Code:
new RandomSongs[][] =
{
{"http://205.196.123.170/3d2pdu41f20g/ek3bk9f6kjgv4gd/Taio+Cruz+Feat.+Flo+Rida+-+Hangover+OFFICIAL+Lyrics.mp3"},
{"http://205.196.121.51/b2zw0h9e49xg/k3r8hr52zlh685p/Wiz+Khalifa+%26+Snoop+Dogg+-+Young%2C+Wild+%26+Free+Ft.+Bruno+Mars+%28Beyond+the+Video%29.mp3"},
{"http://205.196.123.34/e9p671v7dm8g/o1vhayconf16141/Avicii+-+Levels.mp3"}
};
and this:
pawn Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
PlayAudioStreamForPlayer(playerid, RandomSongs);
return 1;
}
but it is giving this error...:
Code:
D:\Program Files\Torreto Racing\gamemodes\TorettoRacing.pwn(7912) : error 048: array dimensions do not match
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
why it is giving this error? and how to fix it?
greets niels
Re: why this is giving error? -
legodude - 27.01.2012
its a array so you have to declare its index
Code:
PlayAudioStreamForPlayer(playerid, RandomSongs[random(sizeof(RandomSongs))]);
will do the job
Re: why this is giving error? -
niels44 - 27.01.2012
ah okay... well eehm i dont understand wut it does else but thnx.. and could you explain?
and yeah it works XD so thnx