SA-MP Forums Archive
Radio - 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: Radio (/showthread.php?tid=288810)



Radio - Dripac - 09.10.2011

Код:
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;
}



Re: Radio - LetsOWN[PL] - 09.10.2011

@1
pawn Код:
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"?


Re: Radio - Dripac - 09.10.2011

Nvm i already got it working now, i will give you +rep