Raised This Month: $ Target: $400
 0% 

New API and Syntax


Post New Thread Reply   
 
Thread Tools Display Modes
Bara
AlliedModders Donor
Join Date: Apr 2012
Location: Germany
Old 04-18-2015 , 14:37   Re: New API and Syntax
Reply With Quote #471

Quote:
Originally Posted by Dr. Api View Post
Ok what will should do instead ?
You cna use old syntax.
__________________
Discord (Bara#5006) | My Plugins (GitHub)
You like my work? Support is not a crime.

Last edited by Bara; 04-18-2015 at 14:37.
Bara is offline
Dr. Api
BANNED
Join Date: Mar 2015
Location: France
Old 04-18-2015 , 14:39   Re: New API and Syntax
Reply With Quote #472

Quote:
Originally Posted by Bara View Post
You cna use old syntax.
I prefer to use one syntax !
Dr. Api is offline
Dr. Api
BANNED
Join Date: Mar 2015
Location: France
Old 04-18-2015 , 15:59   Re: New API and Syntax
Reply With Quote #473

Tag mismatch when I use PrintToDev

PHP Code:
/***********************************************************/
/****************** GET CLIENT BY STEAM ID *****************/
/***********************************************************/
stock void GetClientBySteamIDEx(char[] steamid)
{
    
char steamId[64];
    for(
int i=1;i<=MaxClients;++i)
    {
        if(!
Client_IsIngame(i))
            continue;
        if(!
IsClientAuthorized(i))
            continue;
        
GetClientAuthId(iAuthId_Steam2steamIdsizeof(steamId));
        if (
StrEqual(steamIdsteamid))
            return 
i;
    }
    return 
false;
}

/***********************************************************/
/*********************** PRINT TO DEV **********************/
/***********************************************************/
stock void PrintToDev(bool statuschar[] formatany:...)
{
    if(
status)
    {
        
int client GetClientBySteamIDEx(DEVELOPER);
        if(
client)
        {
            
char msg[MSG_LENGTH];
            
char msg2[MSG_LENGTH];
            
Format(msgMSG_LENGTH"%s%s%s%s"CHAT_HIGHLIGHT_INCTAG_CHAT_INCCHAT_NORMAL_INCformat);
            
VFormat(msg2MSG_LENGTHmsg3);
            
            
Handle hBf;
            
hBf StartMessageOne("SayText2"client);
            if (
hBf != INVALID_HANDLE)
            {
                if (
GetUserMessageType() == UM_Protobuf)
                {
                    
PbSetInt(hBf"ent_idx"client);
                    
PbSetBool(hBf"chat"false);

                    
PbSetString(hBf"msg_name"msg2);
                    
PbAddString(hBf"params""");
                    
PbAddString(hBf"params""");
                    
PbAddString(hBf"params""");
                    
PbAddString(hBf"params""");
                }
                else
                {
                    
BfWriteByte(hBfclient); 
                    
BfWriteByte(hBf0); 
                    
BfWriteString(hBfmsg2);
                }
                
EndMessage();
            }
        }
    }

Dr. Api is offline
Bara
AlliedModders Donor
Join Date: Apr 2012
Location: Germany
Old 04-18-2015 , 16:11   Re: New API and Syntax
Reply With Quote #474

"any:..." -> "any ..."
__________________
Discord (Bara#5006) | My Plugins (GitHub)
You like my work? Support is not a crime.
Bara is offline
Dr. Api
BANNED
Join Date: Mar 2015
Location: France
Old 04-18-2015 , 16:31   Re: New API and Syntax
Reply With Quote #475

this is not the problem actually.
Dr. Api is offline
_AeonOne_
Member
Join Date: Nov 2012
Location: Berlin, Germany
Old 04-18-2015 , 16:45   Re: New API and Syntax
Reply With Quote #476

Quote:
Originally Posted by Dr. Api View Post
this is not the problem actually.
GetClientBySteamIDEx has the wrong return type. It's void, but should be int.
Additionally, returning false to an int is bad coding style (in my opinion) - return 0!
_AeonOne_ is offline
Dr. Api
BANNED
Join Date: Mar 2015
Location: France
Old 04-19-2015 , 03:13   Re: New API and Syntax
Reply With Quote #477

Quote:
Originally Posted by _AeonOne_ View Post
GetClientBySteamIDEx has the wrong return type. It's void, but should be int.
Additionally, returning false to an int is bad coding style (in my opinion) - return 0!
It was return 0 first, I changed when I tried something else. Bu thx I miss stock int instead on stock void.

Last edited by Dr. Api; 04-19-2015 at 03:15.
Dr. Api is offline
nergal
Veteran Member
Join Date: Apr 2012
Old 05-01-2015 , 14:55   Re: New API and Syntax
Reply With Quote #478

Just asking, what are the leftover plans/updates for methodmaps? I'd like to start utilizing them and would like to know about any future changes so that I can quickly fix them up.
__________________
nergal is offline
BAILOPAN
Join Date: Jan 2004
Old 05-04-2015 , 11:52   Re: New API and Syntax
Reply With Quote #479

I think methodmaps are feature complete, unless we've missed something.
__________________
egg
BAILOPAN is offline
kossolax
AlliedModders Donor
Join Date: Jan 2008
Location: Belgium
Old 05-05-2015 , 03:15   Re: New API and Syntax
Reply With Quote #480

Quote:
We may also consider an automatic porting tool for plugins once enough of the API is available.
It might be interesting to have a link of the new syntax to every .sp attached on the forum.

I mean from:
PHP Code:
 Get Plugin or Get Source 
To:
PHP Code:
Get PluginGet SM16 SourceGet SM17 Source 
or something like that.

So more example will be available to everyone, and more coders will switch to the new syntax.

Last edited by kossolax; 05-05-2015 at 03:16.
kossolax 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 10:38.


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