command from zcmd to strcmp
#1

How can I convert this command STRCMP?
Код:
CMD:myskin( playerid, params[] )
{
    if ( P_DATA[ playerid ][ P_Logged ] == 0 )
	    return SendError( playerid, "You must be logged in to change your skin! ~n~Type ~b~~h~/login.");

	if ( sscanf( params, "i", params[ 0 ] ) )
	    return SendUsage( playerid, "/myskin <skin ID>");

    if ( !IsValidSkin( params[ 0 ] ) )
        return SendError( playerid, "Invalid skin inserted!");

	P_DATA[ playerid ][ P_Skin ] = params[ 0 ];
	SetPlayerSkin( playerid, params[ 0 ] );

	new String[ 129 ];
	format( String, sizeof String, "You have changed your skin to ~b~~h~%d~w~. It has been saved into your account, on next login this skin will be applied.", params[ 0 ] );
	Info( playerid,  String, 5000);


	new iUID = BUD::GetNameUID( PlayerName2( playerid ) );
	BUD::SetIntEntry(iUID, "Skin", params[ 0 ] );

	return 1;
}
Reply
#2

Err, why would you convert ZCMD to STRCMP ?
Reply
#3

So, you converted from strcmp to zcmd. And, you decided to convert back because it's rubbish? o.O
Reply
#4

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    new 
cmd[30];
    new 
idx;
    
cmd strtokt(cmdtextidx);
    if(
strcmp(cmdtext"/myskin"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
         {
             new 
tmp[30];
              
tmp strtokt(cmdtextidx);
            if(!
strlen(tmp))
             {
                 
SendClientMessage(playerid, -1"Usage /myskin [Skinid]");
                 return 
1;
            }
            new 
skinid;
            
skinid strval(tmp);
            
SetPlayerSkin(playerid,skinid);
         }
         return 
1;
    }
    return 
0;

PHP код:
strtokt(const string[], &index)
{
    new 
length strlen(string);
    while ((
index length) && (string[index] <= ' '))
    {
        
index++;
    }
    new 
offset index;
    new 
result[20];
    while ((
index length) && (string[index] > ' ') && ((index offset) < (sizeof(result) - 1)))
    {
        
result[index offset] = string[index];
        
index++;
    }
    
result[index offset] = EOS;
    return 
result;

Reply
#5

Why are u converting to STRCMP.ZCMD is better than STRCMP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)