SA-MP Forums Archive
OnPlayerPickUpPickup should return a value (help) - 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: OnPlayerPickUpPickup should return a value (help) (/showthread.php?tid=414766)



OnPlayerPickUpPickup should return a value (help) - Phil_Cutcliffe - 10.02.2013

Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
	if(pickupid == mats) {
    if(PlayerInfo[playerid][pSupplies] >= 750)
	{
 		SendClientMessage(playerid, COLOR_BLUE, "You got 500 mats for your 750 supplies");
   		PlayerInfo[playerid][pMats] = 500;
	    return 1;
	}
	}
    if(pickupid == emtchange) {
    if(PlayerInfo[playerid][pFaction] != 255 && FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 4)
	{
	    TogglePlayerControllable(playerid,false);
		ShowMenuForPlayer(emtclothes,playerid);
	}
	}
    if(pickupid == pdchange) {
    if(PlayerInfo[playerid][pFaction] != 255 && FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 1)
	{
    TogglePlayerControllable(playerid,false);
	ShowMenuForPlayer(pdclothes,playerid);
	}
	}
    if(pickupid == fbichange) {
    if(PlayerInfo[playerid][pFaction] != 255 && FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 2)
	{
    TogglePlayerControllable(playerid,false);
	ShowMenuForPlayer(fbiclothes,playerid);
	}
	}
	if(pickupid == dtp) {
    TogglePlayerControllable(playerid,false);
	ShowMenuForPlayer(DrivingM,playerid);
	}
	if(pickupid == spickup) {
    TogglePlayerControllable(playerid,false);
	ShowMenuForPlayer(FStyles,playerid);
	}
	if(pickupid == ammu) {
    TogglePlayerControllable(playerid,false);
	ShowMenuForPlayer(ammumenu,playerid);
	}
	if(pickupid == wlic) {
    GameTextForPlayer(playerid, "~>~~w~/buyweaplic~<~", 3000, 3);
	}
	if(pickupid == flic) {
    GameTextForPlayer(playerid, "~>~~w~/buyfishlic~<~", 3000, 3);
	}
	if(pickupid == fsell) {
    GameTextForPlayer(playerid, "~>~~w~/sellfish~<~", 3000, 3);
	}
	if(pickupid == drugs) {
	ShowPlayerDialog(playerid,7,DIALOG_STYLE_LIST,"Drugs","Weed Seeds\nCocaine Seeds\nPsilocybin mushrooms Seeds\nLSD(Acid)","Purchase","Cancel");
	}
	if(pickupid == supplies) {
    GameTextForPlayer(playerid, "~>~~w~/buysupplies~<~", 3000, 3);
	}
}
What's wrong here?

Here's the error message I got..
Код:
(17521) : warning 209: function "OnPlayerPickUpPickup" should return a value
Any help is muchly appreciated! =]


Re: OnPlayerPickUpPickup should return a value (help) - Bicentric - 10.02.2013

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == mats) {
    if(PlayerInfo[playerid][pSupplies] >= 750)
    {
        SendClientMessage(playerid, COLOR_BLUE, "You got 500 mats for your 750 supplies");
        PlayerInfo[playerid][pMats] = 500;
        return 1;
    }
    }
    if(pickupid == emtchange) {
    if(PlayerInfo[playerid][pFaction] != 255 && FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 4)
    {
        TogglePlayerControllable(playerid,false);
        ShowMenuForPlayer(emtclothes,playerid);
    }
    }
    if(pickupid == pdchange) {
    if(PlayerInfo[playerid][pFaction] != 255 && FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 1)
    {
    TogglePlayerControllable(playerid,false);
    ShowMenuForPlayer(pdclothes,playerid);
    }
    }
    if(pickupid == fbichange) {
    if(PlayerInfo[playerid][pFaction] != 255 && FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 2)
    {
    TogglePlayerControllable(playerid,false);
    ShowMenuForPlayer(fbiclothes,playerid);
    }
    }
    if(pickupid == dtp) {
    TogglePlayerControllable(playerid,false);
    ShowMenuForPlayer(DrivingM,playerid);
    }
    if(pickupid == spickup) {
    TogglePlayerControllable(playerid,false);
    ShowMenuForPlayer(FStyles,playerid);
    }
    if(pickupid == ammu) {
    TogglePlayerControllable(playerid,false);
    ShowMenuForPlayer(ammumenu,playerid);
    }
    if(pickupid == wlic) {
    GameTextForPlayer(playerid, "~>~~w~/buyweaplic~<~", 3000, 3);
    }
    if(pickupid == flic) {
    GameTextForPlayer(playerid, "~>~~w~/buyfishlic~<~", 3000, 3);
    }
    if(pickupid == fsell) {
    GameTextForPlayer(playerid, "~>~~w~/sellfish~<~", 3000, 3);
    }
    if(pickupid == drugs) {
    ShowPlayerDialog(playerid,7,DIALOG_STYLE_LIST,"Drugs","Weed Seeds\nCocaine Seeds\nPsilocybin mushrooms Seeds\nLSD(Acid)","Purchase","Cancel");
    }
    if(pickupid == supplies) {
    GameTextForPlayer(playerid, "~>~~w~/buysupplies~<~", 3000, 3);
    }
       return 1; //Here
}
You're not returning 1 at the end.


Re: OnPlayerPickUpPickup should return a value (help) - Scyattica - 10.02.2013

You need to put return 1 somewhere where all the code can reach it.

Try this.

Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
	if(pickupid == mats) {
    if(PlayerInfo[playerid][pSupplies] >= 750)
	{
 		SendClientMessage(playerid, COLOR_BLUE, "You got 500 mats for your 750 supplies");
   		PlayerInfo[playerid][pMats] = 500;
	}
	}
    if(pickupid == emtchange) {
    if(PlayerInfo[playerid][pFaction] != 255 && FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 4)
	{
	    TogglePlayerControllable(playerid,false);
		ShowMenuForPlayer(emtclothes,playerid);
	}
	}
    if(pickupid == pdchange) {
    if(PlayerInfo[playerid][pFaction] != 255 && FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 1)
	{
    TogglePlayerControllable(playerid,false);
	ShowMenuForPlayer(pdclothes,playerid);
	}
	}
    if(pickupid == fbichange) {
    if(PlayerInfo[playerid][pFaction] != 255 && FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 2)
	{
    TogglePlayerControllable(playerid,false);
	ShowMenuForPlayer(fbiclothes,playerid);
	}
	}
	if(pickupid == dtp) {
    TogglePlayerControllable(playerid,false);
	ShowMenuForPlayer(DrivingM,playerid);
	}
	if(pickupid == spickup) {
    TogglePlayerControllable(playerid,false);
	ShowMenuForPlayer(FStyles,playerid);
	}
	if(pickupid == ammu) {
    TogglePlayerControllable(playerid,false);
	ShowMenuForPlayer(ammumenu,playerid);
	}
	if(pickupid == wlic) {
    GameTextForPlayer(playerid, "~>~~w~/buyweaplic~<~", 3000, 3);
	}
	if(pickupid == flic) {
    GameTextForPlayer(playerid, "~>~~w~/buyfishlic~<~", 3000, 3);
	}
	if(pickupid == fsell) {
    GameTextForPlayer(playerid, "~>~~w~/sellfish~<~", 3000, 3);
	}
	if(pickupid == drugs) {
	ShowPlayerDialog(playerid,7,DIALOG_STYLE_LIST,"Drugs","Weed Seeds\nCocaine Seeds\nPsilocybin mushrooms Seeds\nLSD(Acid)","Purchase","Cancel");
	}
	if(pickupid == supplies) {
    GameTextForPlayer(playerid, "~>~~w~/buysupplies~<~", 3000, 3);
	}
     return 1;
}



Re: OnPlayerPickUpPickup should return a value [solved] - Phil_Cutcliffe - 10.02.2013

I just removed the return 1 and now it's fine..

+Rep for both thanks for help