SA-MP Forums Archive
warning 239: literal array/string passed to a non-const parameter - 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: warning 239: literal array/string passed to a non-const parameter (/showthread.php?tid=661471)



warning 239: literal array/string passed to a non-const parameter - StRaphael - 05.12.2018

Hello, I got lots of warnings when I use this function:
PHP код:
stock PlayAudioStreamForPlayersInCar(vehicleidurl[])
{
    foreach(new 
Player)
    {
        if(
IsPlayerInAnyVehicle(i))
        {
            if(
GetPlayerVehicleID(i) == vehicleid)
            {
                
PlayAudioStreamForPlayer(i,url);
            }
        }
    }
    return 
1;
}
PlayAudioStreamForPlayersInCar(vehicleid"http://RadioURL.domain");// warning 239: literal array/string passed to a non-const parameter 
How can I solve these warnings?
Thank you in advance!


Re: warning 239: literal array/string passed to a non-const parameter - v1k1nG - 05.12.2018

PHP код:
stock PlayAudioStreamForPlayersInCar(vehicleid, const url[]) 



Re: warning 239: literal array/string passed to a non-const parameter - StRaphael - 05.12.2018

Quote:
Originally Posted by v1k1nG
Посмотреть сообщение
PHP код:
stock PlayAudioStreamForPlayersInCar(vehicleid, const url[]) 
I tried but I got error on PlayAudioStreamForPlayer(i,url); // error 035: argument type mismatch (argument 2)


Re: warning 239: literal array/string passed to a non-const parameter - v1k1nG - 05.12.2018

Quote:
Originally Posted by StRaphael
Посмотреть сообщение
I tried but I got error on PlayAudioStreamForPlayer(i,url); // error 035: argument type mismatch (argument 2)
Open your includes folder, find a_players.inc and look for

PHP код:
native PlayAudioStreamForPlayer(playeridurl[], Float:posX 0.0Float:posY 0.0Float:posZ 0.0Float:distance 50.0usepos 0); 
edit it to

PHP код:
native PlayAudioStreamForPlayer(playerid, const url[], Float:posX 0.0Float:posY 0.0Float:posZ 0.0Float:distance 50.0usepos 0); 



Re: warning 239: literal array/string passed to a non-const parameter - StRaphael - 05.12.2018

Quote:
Originally Posted by v1k1nG
Посмотреть сообщение
Open your includes folder, find a_players.inc and look for

PHP код:
native PlayAudioStreamForPlayer(playeridurl[], Float:posX 0.0Float:posY 0.0Float:posZ 0.0Float:distance 50.0usepos 0); 
edit it to

PHP код:
native PlayAudioStreamForPlayer(playerid, const url[], Float:posX 0.0Float:posY 0.0Float:posZ 0.0Float:distance 50.0usepos 0); 
Thank you, it worked!
+rep