Help with showplayerdialog
#1

C:\Users\Wallen\Desktop\LS DM\gamemodes\DBv1.pwn(1677) : warning 209: function "SellWeapon" should return a value
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.


Код:
stock SellWeapon(playerid, points, weapon, ammo)
{
   new ppoints = GetPlayerPoints(playerid);
   if(ppoints>=points)
   {
	  new string[80], weaponname[32];
	  GivePlayerPoints(playerid, -points);
	  GetPlayerPoints(playerid);
	  GivePlayerWeapon(playerid, weapon,ammo);
	  GetWeaponName(weapon, weaponname, sizeof(weaponname));
	  format(string, sizeof(string), "{EFB509}* You have bought %s with %i ammo for %i points", weaponname, ammo, points);
	  return SendClientMessage(playerid, -1, string);
    }
  	else
	{
	SendClientMessage(playerid, -1,"{FF0000}* You don't have enough points to buy this item !");
  	ShowPlayerDialog(playerid, 8, DIALOG_STYLE_TABLIST_HEADERS, "Market",
	"Weapon \tPrice \tAmmo \tSlots\n\
	Desert Eagle\t{4286f4}15 Points\t100 \tInfinite\n\
	Shotgun\t{4286f4}10 Points\t40\tInfinite\n\
	Spas\t{4286f4}40 Points\t100\tInfinite\n\
	M4\t{4286f4}10 Points\t90\tInfinite\n\
	Sniper\t{4286f4}30 Points\t30\tInfinite\n\
	Full Health\t{4286f4}150 Points\t-\tInfinite",
	"Buy", "Leave");
}
}
Just wanted to make something like that:

If he go /shop, clicks M4 for example and he got 0 points then he obv gets the message "you dont have enough points" but after that i dont want that the player quits from the dialog, it shows him back. I did that with else function and i get 1 warning which cant figure out where is the issue.
Reply
#2

Warnings pretty self explanatory.

Just return 1 at the end of the function.
Reply
#3

Thanks appreciated !
Reply
#4

Код:
stock SellWeapon(playerid, points, weapon, ammo)
{
   new ppoints = GetPlayerPoints(playerid);
   if(ppoints>=points)
   {
	  new string[80], weaponname[32];
	  GivePlayerPoints(playerid, -points);
	  GetPlayerPoints(playerid);
	  GivePlayerWeapon(playerid, weapon,ammo);
	  GetWeaponName(weapon, weaponname, sizeof(weaponname));
	  format(string, sizeof(string), "{EFB509}* You have bought %s with %i ammo for %i points", weaponname, ammo, points);
	  return SendClientMessage(playerid, -1, string);
    }
  	else
	{
	SendClientMessage(playerid, -1,"{FF0000}* You don't have enough points to buy this item !");
  	ShowPlayerDialog(playerid, 8, DIALOG_STYLE_TABLIST_HEADERS, "Market",
	"Weapon \tPrice \tAmmo \tSlots\n\
	Desert Eagle\t{4286f4}15 Points\t100 \tInfinite\n\
	Shotgun\t{4286f4}10 Points\t40\tInfinite\n\
	Spas\t{4286f4}40 Points\t100\tInfinite\n\
	M4\t{4286f4}10 Points\t90\tInfinite\n\
	Sniper\t{4286f4}30 Points\t30\tInfinite\n\
	Full Health\t{4286f4}150 Points\t-\tInfinite",
	"Buy", "Leave");
}
return 1; //this
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)