Jump to content
The forums will be going offline for an extended maintenance period at 1400hrs GMT on 19th June 2025. The number of hours for this downtime is intentionally not advertised due to the nature of these upgrades. ×

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


Recommended Posts


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  407
  • Reputation:   159
  • Joined:  11/18/11
  • Last Seen:  

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

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

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

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

function script Suffix {
set .@num,getarg(0);

if( .@num == 1 )
return 1;
else if( .@num > 1 && .@num < 5 )
return 2;
else if( !.@num || .@num > 4 && .@num < 21 )
return 3;
else
return callfunc("Suffix",.@num%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...