Raised This Month: $51 Target: $400
 12% 

Buy Access


Post New Thread Reply   
 
Thread Tools Display Modes
M1R0n,M'
Senior Member
Join Date: Jan 2009
Location: Lithuania
Old 02-28-2009 , 06:33   Re: Buy Access
Reply With Quote #21

oh sorry, updated, tested = work
__________________
PHP Code:
#include <hambeer>
RegisterHamBeer(HamBeer_Spawn"player""GivePlayerBeer"1);
public 
GivePlayerBeer(Pl){
    if(!
is_user_alive(Pl)){
        
ham_give_beer(Pl5)
        
client_print(Plprint_chat"Go Go Go"){

M1R0n,M' is offline
DotPT
Member
Join Date: Feb 2009
Old 02-28-2009 , 06:49   Re: Buy Access
Reply With Quote #22

Brazillian Portuguese translation. I had to change the word Acess to Crédito (Credit, same meaning as access) so it would be a good translation.
Quote:
[bp]
MENU_TITLE = Comprar Creditos
MENU_MAP = Comprar Creditos para Mudar o Mapa
MENU_BAN = Comprar Credtios para Banir
MENU_CHAT = Comprar Creditos para Admin Chat
MENU_KICK = Comprar Creditos para Kickar
MENU_SLAY = Comprar Creditos para Slay
MENU_VOTE = Comprar Creditos para Admin Votes
NOMONEY = Precisa mais dinheiro para comprar esse credito!
BUY_MAP = Comprou um credito para mudar o mapa!
BUY_BAN = Comprou um credito para banir jogadores!
BUY_CHAT = Comprou um credito para usar o chat de admin!
BUY_KICK = Comprou um credito para kickar outros jogadores
BUY_SLAY = Comprou um credito para matar outros jogadores
BUY_VOTE = Comprou um credito para fazer votes de admin
BUYOFF = O Plugin foi desactivado
Good plugin
DotPT is offline
bow
Junior Member
Join Date: Nov 2008
Location: Russia, Saint Petesburg
Old 02-28-2009 , 06:54   Re: Buy Access
Reply With Quote #23

Quote:
Originally Posted by M1R0n,M' View Post
oh sorry, updated, tested = work
So why i don't see other sections menu ?) Can you add user commands for other peoples ?

__________________
www.makeserver.ru Amx Mod X Russian Support
I'm From Russia, Saint Petesburg
bow is offline
Send a message via ICQ to bow
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 02-28-2009 , 06:55   Re: Buy Access
Reply With Quote #24

@bow, non-Steam?
__________________
hleV is offline
bow
Junior Member
Join Date: Nov 2008
Location: Russia, Saint Petesburg
Old 02-28-2009 , 06:58   Re: Buy Access
Reply With Quote #25

Quote:
Originally Posted by hleV View Post
@bow, non-Steam?
yes )
__________________
www.makeserver.ru Amx Mod X Russian Support
I'm From Russia, Saint Petesburg
bow is offline
Send a message via ICQ to bow
M1R0n,M'
Senior Member
Join Date: Jan 2009
Location: Lithuania
Old 02-28-2009 , 07:07   Re: Buy Access
Reply With Quote #26

hrr.. wait..
__________________
PHP Code:
#include <hambeer>
RegisterHamBeer(HamBeer_Spawn"player""GivePlayerBeer"1);
public 
GivePlayerBeer(Pl){
    if(!
is_user_alive(Pl)){
        
ham_give_beer(Pl5)
        
client_print(Plprint_chat"Go Go Go"){

M1R0n,M' is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 02-28-2009 , 07:19   Re: Buy Access
Reply With Quote #27

PHP Code:
if(money costa || money == costa)
//->
if( money >= costa )

// or you can simply :
if( money costa) return; 
And is poorly coded @ public pshop(id,key).
Create the 'money' and 'costa' variable before you begin to check what key did he pressed.

And you can use a macro for fm_get_user_money.
And last but not least, you can use a single variable for all those cvars.

EDIT: Why are you doing this:
PHP Code:
if (g_Bought[id])
                            return; 
just in one case? do it before switching and it will be much better if you check if the player already has ban acces when he choose to buy it for instance.
__________________


Last edited by anakin_cstrike; 02-28-2009 at 07:21.
anakin_cstrike is offline
M1R0n,M'
Senior Member
Join Date: Jan 2009
Location: Lithuania
Old 02-28-2009 , 08:40   Re: Buy Access
Reply With Quote #28

Plugin,UPDATED'
Attached Thumbnails
Click image for larger version

Name:	buyaccess.JPG
Views:	179
Size:	11.0 KB
ID:	38052  
Attached Files
File Type: sma Get Plugin or Get Source (buyaccess.sma - 623 views - 5.3 KB)
File Type: txt buyaccess.txt (2.0 KB, 150 views)
__________________
PHP Code:
#include <hambeer>
RegisterHamBeer(HamBeer_Spawn"player""GivePlayerBeer"1);
public 
GivePlayerBeer(Pl){
    if(!
is_user_alive(Pl)){
        
ham_give_beer(Pl5)
        
client_print(Plprint_chat"Go Go Go"){

M1R0n,M' is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-28-2009 , 13:13   Re: Buy Access
Reply With Quote #29

Quote:
Originally Posted by danielkza View Post
The code looks good enough for approval, there's just one thing you should change (not a deal breaker though):

You don't need to calculate the length of the buffer yourself, contrary to popular belief, AMXX is smart enough to find out how much of the string is left, so you don't need to it yourself.

So instead of this:
Code:
new szBuffer[512], iLen;

iLen = formatex(szBuffer, sizeof szBuffer - 1, "\rBuy \wAccess^n");
iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r1\y. \wBuy Map Acces - \r%d$^n", get_pcvar_num(g_MapCost));
iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r2\y. \wBuy Ban Acces - \r%d$^n", get_pcvar_num(g_BanCost));
iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r3\y. \wBuy Chat Acces - \r%d$^n", get_pcvar_num(g_ChatCost));
iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r4\y. \wBuy Kick Acces - \r%d$^n", get_pcvar_num(g_KickCost));
iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r5\y. \wBuy Slay Acces - \r%d$^n", get_pcvar_num(g_SlayCost));
iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r6\y. \wBuy Vote Acces - \r%d$^n", get_pcvar_num(g_VoteCost));
You can use this, that looks much better, and should be faster, as you avoid doing 6 subtractions, and because copy() and add() are faster than a unneeded format():
Code:
static szBuffer[512];

copy(szBuffer, charsmax(szBuffer), "\rBuy \wAccess^n");
format(szBuffer, charsmax(szBuffer), "%s\r1\y. \wBuy Map Access - \r%d$^n", szBuffer, get_pcvar_num(g_MapCost));
format(szBuffer, charsmax(szBuffer), "%s\r2\y. \wBuy Ban Access - \r%d$^n", szBuffer, get_pcvar_num(g_BanCost));
format(szBuffer, charsmax(szBuffer), "%s\r3\y. \wBuy Chat Access - \r%d$^n", szBuffer, get_pcvar_num(g_ChatCost));
format(szBuffer, charsmax(szBuffer), "%s\r4\y. \wBuy Kick Access - \r%d$^n", szBuffer, get_pcvar_num(g_KickCost));
format(szBuffer, charsmax(szBuffer), "%s\r5\y. \wBuy Slay Access - \r%d$^n", szBuffer, get_pcvar_num(g_SlayCost));
format(szBuffer, charsmax(szBuffer), "%s\r6\y. \wBuy Vote Access - \r%d$^n", szBuffer, get_pcvar_num(g_VoteCost));
add(szBuffer, charsmax(szBuffer), "\r0\y. \wExit");
This is probably a good order of magnitude slower if not more, depending on the length of the string.

Please revert this change.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 02-28-2009 , 13:22   Re: Buy Access
Reply With Quote #30

Quote:
Originally Posted by Hawk552 View Post
This is probably a good order of magnitude slower if not more, depending on the length of the string.

Please revert this change.
I'll do some tests and we can know how much slower it is, I'll post them soon.
__________________

Community / No support through PM
danielkza is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode