PDA

View Full Version : Radio


Dripac
09/10/2011, 07:12 AM
CMD:buyradio(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 1211.3070,-916.5763,43.0241))
{
PlayerInfo[playerid][pRadio] = 1;
GivePlayerCash(playerid, -250);
SendClientMessage( playerid, COLOR_YELLOW, "Du hast dir einen Radio gekauft! Du kannst es mit /radio verwenden." );
SavePlayer(playerid);
}
else SendClientMessage( playerid, COLOR_GREY, "Du bist nicht beim BSN!" );
return 1;
}

Problems
1) If i buy the radio i still can't use /radio
2) It doesn't change in the users file from Radio=0 to Radio=1

Here the radio command
CMD:radio(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(PlayerInfo[playerid][pRadio] == 1)
{
ShowPlayerDialog(playerid,14147,DIALOG_STYLE_LIST,"{B89200}Wähle einen Song aus den du dir anhören willst:",songstr,"Einschalten","Ausschalten");
}
else
{
SendClientMessage(playerid,COLOR_GREY,"Du hast keinen Radio! Du kannst dir eins beim BSN kaufen.");
}
return 1;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"Du kannst nur im Fahrzeug den Radio verwenden!");
}
return 1;
}

LetsOWN[PL]
09/10/2011, 07:24 AM
@1
CMD:radio(playerid)
{
while(PlayerInfo[playerid][pRadio] != 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
ShowPlayerDialog(playerid,14147,DIALOG_STYLE_LIST,"{B89200}Wähle einen Song aus den du dir anhören willst:",songstr,"Einschalten","Ausschalten");
}
else if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,COLOR_GREY,"Du kannst nur im Fahrzeug den Radio verwenden!");
}
return 1;
}

if(PlayerInfo[playerid][pRadio] == 0)
{
SendClientMessage(playerid,COLOR_GREY,"Du hast keinen Radio! Du kannst dir eins beim BSN kaufen.");
return 1;
}
}

The code looks weirdly, but it should work (aint tested it btw)

@2. Is there any function which will write into file the new value of "Radio"?

Dripac
09/10/2011, 07:26 AM
Nvm i already got it working now, i will give you +rep