SA-MP Forums Archive
problem with ,,new'' - 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: problem with ,,new'' (/showthread.php?tid=513052)



problem with ,,new'' - rumen98 - 14.05.2014

PHP код:
stock GivePlayerItem(playerid,legalitem,item,ammount,percent)
{
    new 
item random(ammount);
    switch (
random(percent))
    {
        case 
01:
        {
        
RLTnfo[playerid][legalitem] += item;
        
metal += item;
    new 
rep[128];
    
format (repsizeof(rep), "Found Metal %d",item);
    
SendClientMessage(playeridCOLOR_LIGHTBLUE"Scavenge Report:");
    
SendClientMessage(playeridCOLOR_LIGHTBLUErep);
        }
    }
    return 
0;

How can replace a
PHP код:
new item random (amount
; by Index Stock Index by itself 3 "item" to make the same function as the new item ...


Re: problem with ,,new'' - rumen98 - 14.05.2014

****** translate...


Re: problem with ,,new'' - rumen98 - 14.05.2014

No Bulgarian section


Re: problem with ,,new'' - rumen98 - 14.05.2014

I just want to know how to do,, item'' himself Stock receive constant number generated by the random and it introduces the 3 places


Re: problem with ,,new'' - rumen98 - 14.05.2014

....


Re: problem with ,,new'' - rumen98 - 14.05.2014

AFP can not explain what I want to do just what I want ,,fmetal'' from
PHP код:
GivePlayerItem (playeridMetalfmetal10,2); 
just replace this
PHP код:
new item random (amount); 
but when out of
PHP код:
stock GivePlayerItem (playeridlegalitemitemamountpercent

eg write testmetal and I very,, item'' from Stock to replace just that,, item'' of
PHP код:
new item.... 
gives me Warnings which provide a top

I just want this to be
PHP код:
 new 
with a different name every time he enters the third parameter to the function


Re: problem with ,,new'' - Konstantinos - 14.05.2014

"item" is a defined symbol and it's a parameter of GivePlayerItem function. By declaring "item" as a new variable will give you the warnings.

If you want to store the value of a random amount to a variable, then use another name other than "item" for it.


Re: problem with ,,new'' - rumen98 - 14.05.2014

Yeah but that's the work that you have for each subject to make separate Function examples should do 15 function GivePlayerMetal, GivePlayerWood and each is different,, new''

Is there no way just by himself Stock to enter any keyword that can be used the same as new to store the number of random


Re: problem with ,,new'' - rumen98 - 14.05.2014

This is my new project that go from house to house searching for supplies such as metal, wood, cloth and other work with them to produce different things and this is my Stock system that gives you different chances to find something different and the amount of it I hope you understand it


Re: problem with ,,new'' - Beckett - 14.05.2014

As ****** said you're confusing between a stock and a function.