Use a variable in whole script
#1

Hello !
Well i have this ******* to mp3 code
PHP код:
stock *******StreamForPlayer(playeridvlink[])
{
    new 
mp3link[128];
    
format(mp3link,128,"http://www.*******inmp3.com/fetch/?video=%s",vlink);
    
PlayAudioStreamForPlayersInCar(GetPlayerVehicleID(playerid),mp3link);
    return 
1;

I want the mp3link to be used in another code ( for each vehicle )
so simply when someone gets in vehicle as driver or passenger, will hear the link in mp3link variable ( that was set by the last driver ),
( it says error 017: undefined symbol "mp3link" , i hope if i can store it )
Help please :3
Reply
#2

Use OnPlayerStateChange, refer wiki page for more info about it.
Reply
#3

i already have the code of //PLAYER_STATE , but i need the string of mp3link to be used in whole script!!!!
Reply
#4

just put it in global space (outside any brackets)
Reply
#5

in top of script?
aand for each vehicle?
Reply
#6

Yeah, all way to the top below your includes and definitions
Reply
#7

what about each vehicle?
Reply
#8

Check OnPlayerStateChange callback when a player get in a car set your *******Stream... function
Reply
#9

Make a variable like

new MusicLink[MAX_VEHICLES][128];

place this at the top of your script below the includes and defines then set this when a player sets the ******* link, then within onplayerstatechange when a player enters a certin vehicle use that variable like

MusicLink[vehid];
Reply
#10

Thanks that's what i was looking for
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)