SA-MP Forums Archive
about weapon shop - 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: about weapon shop (/showthread.php?tid=631344)



about weapon shop - astanalol - 27.03.2017

hello guys
i trying to making weapon shop
weapon id (31)
Ammo (player type his ammo from 1bullet to 10000bullet)
money cost (1bullet = 100$ > when he is typing his bullet 10bullet buying it cost 1000$ Etc)
can somone help me please!
+rep


Re: about weapon shop - LazzyBoy - 27.03.2017

You trying to make it on CMD or dialogs

also show your codes please.


Re: about weapon shop - astanalol - 27.03.2017

Quote:
Originally Posted by LazzyBoy
Посмотреть сообщение
You trying to make it on CMD or dialogs

also show your codes please.
PHP код:
public OnPlayerText(playeridtext[])
{
    if(
text[0] == '1')
    {
        if(
FirstWeaponText[playerid] == 1)
        {
           
//code
        
}
    } 



Re: about weapon shop - LazzyBoy - 27.03.2017

Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '1')
    {
        if(FirstWeaponText[playerid] == 1)
        {
		   new Amount;
		   if( sscanf ( params, "d",iAmount))  return SendClientMessage(playerid,-1, "[amount]");// amount he wants.
           if(Amount < 1 || Amount > 10000) return SendClientMessage(playerid,-1,"You can only buy from 1 - 10000 bullets");// check if player has writen more than required
           {
			   GivePlayerMoney(playerid,-Amount*100); // this makes 1 bullet for 100$
			   GivePlayerWeapon(playerid,weapon you want,Amount);// give player weapon
	       }
        }
    }
Should work.


Re: about weapon shop - astanalol - 27.03.2017

Quote:
Originally Posted by LazzyBoy
Посмотреть сообщение
Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '1')
    {
        if(FirstWeaponText[playerid] == 1)
        {
		   new Amount;
		   if( sscanf ( params, "d",iAmount))  return SendClientMessage(playerid,-1, "[amount]");// amount he wants.
           if(Amount < 1 || Amount > 10000) return SendClientMessage(playerid,-1,"You can only buy from 1 - 10000 bullets");// check if player has writen more than required
           {
			   GivePlayerMoney(playerid,-Amount*100); // this makes 1 bullet for 100$
			   GivePlayerWeapon(playerid,weapon you want,Amount);// give player weapon
	       }
        }
    }
Should work.
i have error
(377) : error 017: undefined symbol "params"
(381) : error 017: undefined symbol "weapon"
(381) : error 017: undefined symbol "you"
(381) : error 017: undefined symbol "want"
(381) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.
[/QUOTE]
Line (377)
PHP код:
           if( sscanf params"d",iAmount))  return SendClientMessage(playerid,-1"[amount]");// amount he wants. 
Line (381)
PHP код:
               GivePlayerWeapon(playerid,weapon you want,Amount);// give player weapon 



Re: about weapon shop - LazzyBoy - 27.03.2017

Код:
#include zcmd


GivePlayerWeapon(playerid,31,Amount);



Re: about weapon shop - astanalol - 27.03.2017

Quote:
Originally Posted by LazzyBoy
Посмотреть сообщение
Код:
#include zcmd


GivePlayerWeapon(playerid,31,Amount);
i already using zcmd inc
Quote:

(377) : error 017: undefined symbol "params"

PHP код:
if( sscanf params"d",iAmount)) 



Re: about weapon shop - J0sh... - 27.03.2017

if(sscanf(text[1], ...

If you actually read the error you would've known me lad.


Re: about weapon shop - astanalol - 27.03.2017

Quote:
Originally Posted by Freshncool
Посмотреть сообщение
if(sscanf(text[1], ...

If you actually read the error you would've known me lad.
u mean like this ?
PHP код:
if(sscanf(text[0] == '1'
?


Re: about weapon shop - J0sh... - 27.03.2017

No, I just gave you most of the bloody code.

PHP код:
if( sscanf text[1], "d",iAmount))  return SendClientMessage(playerid,-1"[amount]");// amount he wants.