- Updated 'checkweight' example. Apple is item_id 512, not 502!

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16845 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
brianluau 2012-10-30 21:53:34 +00:00
parent b69048d9c5
commit 9c5992bb68

View File

@ -3359,32 +3359,30 @@ capacity, and 0 otherwise. It is important to see if a player can carry the
items you expect to give them, failing to do that may open your script up to items you expect to give them, failing to do that may open your script up to
abuse or create some very unfair errors. abuse or create some very unfair errors.
This function, in addition to checking to see if the player is capable of This function, in addition to checking to see if the player is capable of
holding a set amount of items, also ensures the player has room in their holding a set amount of items, also ensures the player has room in their
inventory for the item(s) they will be receiving. inventory for the item(s) they will be receiving.
Like 'getitem', this function will also accept an 'english name' from the Like 'getitem', this function will also accept an 'english name' from the
database as an argument. database as an argument.
checkweight(502,10) // 10 apples if (checkweight(512,10)) {
getitem 512,10;
if (checkweight(502,10) == 0 ) goto L_OverWeight; } else {
getitem 502,10; mes "Sorry you cannot hold this amount of apples";
close; }
L_OverWeight: close;
mes "Sorry you cannot hold this amount of apples";
close;
Or to put this another way: Or to put this another way:
if (checkweight("APPLE",10)) goto L_Getapples; if (checkweight("Apple",10) == 0) {
mes "Sorry you cannot hold this amount of apples"; mes "Sorry you cannot hold this amount of apples";
close; } else {
L_Getapples: getitem 512,10;
getitem 502,10; }
close; close;
Both these examples have the same effect. Both examples have the same effect.
--------------------------------------- ---------------------------------------