Help with showplayerdialog - 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: Help with showplayerdialog (
/showthread.php?tid=649255)
Help with showplayerdialog -
wallen - 05.02.2018
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.
Re: Help with showplayerdialog -
Kane - 05.02.2018
Warnings pretty self explanatory.
Just return 1 at the end of the function.
Re: Help with showplayerdialog -
wallen - 05.02.2018
Thanks appreciated !
Re: Help with showplayerdialog -
dani18 - 05.02.2018
Код:
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
}