22.01.2012, 19:17
So I've been working on my script, but the problem is, the variables are applying for everybody. I want everybody to go by the same variable, but each individual has there own value. What it does right now, is if somebody does /radiooff, it'll turn the radio variable to 0 for everybody.
All I'm doing is putting the variable at the top of the script like this:
Then, the script for it is:
Then, the radio on is:
The radio-- and radio++ are taking affect for everybody's variables.
Help Please!
All I'm doing is putting the variable at the top of the script like this:
PHP код:
new radio = 1
PHP код:
if (strcmp("/radiooff", cmdtext, true, 10) == 0)
{
if(radio == 1)
{
StopAudioStreamForPlayer(playerid);
SendClientMessage(playerid, white, "To turn the radio back on, do /radioon");
radio--;
}
else if(radio == 0)
{
SendClientMessage(playerid, white, "Your radio is already off!");
}
}
PHP код:
if (strcmp("/radioon", cmdtext, true, 10) == 0)
{
if(radio == 0)
{
PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283896");
SendClientMessage(playerid, white, "Your radio has been turned on. To turn it off, type /radiooff");
radio++;
}
else if(radio == 1)
{
SendClientMessage(playerid, white, "Your radio is already on, to turn it off, do /radiooff!");
}
}
Help Please!