Jump to content
Lilith

Окончания слов

Recommended Posts

Бывало сталкивался с проблемой образования окончаний у слов, которые обозначают множество того или иного.

К примеру, у одного игрока 123 TCG карты, у другого 61 и т.д. Как правильно определить окончание для слова 'карта' в каждом случае?

Написал маленькую функцию, думаю, резберётесь.

prontera,150,180,5 script Пример 100,{
setarray @word$[1],"карта","карты","карт";
mes "Введите число";
input @c;
mes @c+" "[email protected]$[callfunc("Suffix",@c)];
close;
}

function script Suffix {
set [email protected],getarg(0);

if( [email protected] == 1 )
return 1;
else if( [email protected] > 1 && [email protected] < 5 )
return 2;
else if( [email protected] || [email protected] > 4 && [email protected] < 21 )
return 3;
else
return callfunc("Suffix",[email protected]%10);
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.