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

Common Issues and Examples/Solutions


Post New Thread Reply   
 
Thread Tools Display Modes
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 07-06-2010 , 14:36   Re: Common Issues and Examples/Solutions
Reply With Quote #21

It returns the remainder of a division.

6 % 5 == 1
7 % 1 == 0
4 % 2 == 0
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 07-06-2010 , 17:59   Re: Common Issues and Examples/Solutions
Reply With Quote #22

http://en.wikipedia.org/wiki/Modulo_operator

Edit: Didn't see second page, sorry.
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 07-11-2010 , 16:09   Re: Common Issues and Examples/Solutions
Reply With Quote #23

wrecked, please change this in my code:

Code:
    if(equali(szClassName, g_RemoveEntity) )         return FMRES_SUPERCEDE;

Code:
    if(equali(szClassName, g_RemoveEntity) )     {         engfunc(EngFunc_RemoveEntity, iEntity);         return FMRES_SUPERCEDE;     }

My mistake.

And also i have a question, how to properly catch when the player join to a team? i know some methods but, wich is the best?
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
Old 07-12-2010, 03:35
Kreation
This message has been deleted by Kreation. Reason: nvm.
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 07-12-2010 , 06:23   Re: Common Issues and Examples/Solutions
Reply With Quote #24

Quote:
Originally Posted by Alucard^ View Post
And also i have a question, how to properly catch when the player join to a team? i know some methods but, wich is the best?
The first team join?
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 07-12-2010 , 07:43   Re: Common Issues and Examples/Solutions
Reply With Quote #25

Yes.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 07-12-2010 , 10:34   Re: Common Issues and Examples/Solutions
Reply With Quote #26

Quote:
Originally Posted by Alucard^ View Post
wrecked, please change this in my code:

Code:
    if(equali(szClassName, g_RemoveEntity) )         return FMRES_SUPERCEDE;

Code:
    if(equali(szClassName, g_RemoveEntity) )     {         engfunc(EngFunc_RemoveEntity, iEntity);         return FMRES_SUPERCEDE;     }

My mistake.

And also i have a question, how to properly catch when the player join to a team? i know some methods but, wich is the best?
Fixed.

Also, I always hook TeamInfo, with the 2nd byte in the data structure being the team they join.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 07-12-2010 , 12:27   Re: Common Issues and Examples/Solutions
Reply With Quote #27

I'll use SortCustom2D to sort scores, assuming you're saving the scores on a bidimensional array, where the first index contains the userid and the second index contains the user score.
PHP Code:
stock sortScores(const scores[33][2]) {
    
SortCustom2D(scores33"sortScoresCompFunc");
}

public 
sortScoresCompFunc(const elem1[], const elem2[]) {
    return (
elem1[1] < elem2[1] ? -
                (
elem1[1] > elem2[1] ? 0));

I don't have access to a compiler right now, as I'm posting from my college's lab, but it should work.

If you want to avoid the native for obscure reasons you can use conditional selection sorting to sort the original array into another, but SortCustom2D is a cleaner method.

You may have seen that I've hardcoded the array size to [33][2], but you can easily adapt this to sort an arbitrary number of users.
Seta00 is offline
eXtrem
Member
Join Date: Jul 2011
Old 03-07-2012 , 16:58   Re: Common Issues and Examples/Solutions
Reply With Quote #28

How to properly check if player is vip using fakemeta.

PHP Code:
#include <amxmodx>
#include <fakemeta>

const OFFSET_VIP    =   209;
const 
PLAYER_VIP    =   256// 1<<8

// ...

    
if( get_pdata_intidOFFSET_VIP) & PLAYER_VIP )
    {
        
// player is vip
    


Last edited by eXtrem; 03-07-2012 at 17:20.
eXtrem is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-07-2012 , 17:29   Re: Common Issues and Examples/Solutions
Reply With Quote #29

cs_get_user_vip
__________________

Last edited by Arkshine; 03-07-2012 at 17:29.
Arkshine is offline
Old 03-07-2012, 17:58
Devil259
This message has been deleted by Devil259.
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 03-09-2012 , 19:17   Re: Common Issues and Examples/Solutions
Reply With Quote #30

A good way to remove droped weapons?

__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
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 02:04.


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