[Help] /state
#1

Hello, what happens is that when someone gets a /state comes off the other player who had a /state how I do not go out to those who already have a /state?

Commands:


Quote:

new Text3D:giPlayerStatus[ MAX_PLAYERS ];


zcmd(state, playerid, params[]) {
if( !IsPlayerConnected( playerid ) ) return 0;

if( !sscanf( params, "s[32]", params[ 0 ] ) ) {
new szFormat[ 2 ][ 50 ];
format( szFormat[ 0 ], 31, "%s", params[ 0 ] );
format( szFormat[ 1 ], 49, "State: %s.", szFormat[ 0 ] );
SendClientMessageEx( playerid, COLOR_GRAD2, szFormat[ 1 ] );

Delete3DTextLabel( giPlayerStatus[ playerid ] );
giPlayerStatus[ playerid ] = Create3DTextLabel( szFormat[ 0 ], 0x68EA6CFF, 1.0, 1.0, 1.0, 15.0, 0, 1 );

Attach3DTextLabelToPlayer( giPlayerStatus[ playerid ], playerid, 0.0, 0.0, 0.3 );
}

return 1;
}

zcmd(qstate, playerid, params[]) {
if( !IsPlayerConnected( playerid ) ) return 0;
Delete3DTextLabel( giPlayerStatus[ playerid ] );
SendClientMessageEx( playerid, COLOR_GRAD2, "State have been removed." );
return 1;
}

Reply
#2

Help
Reply
#3

Hello!

Try this:
PHP код:
new Text3D:giPlayerStatus[MAX_PLAYERS] = {-1,...};
zcmd(state,playerid,params[])
{
    if(!
sscanf(params,"s[32]",params[0]))
    {
        new 
szFormat[50];
        
format(szFormat,sizeof szFormat,"State: %s.",params[0]);
        
SendClientMessageEx(playerid,COLOR_GRAD2,szFormat);
        
Delete3DTextLabel(giPlayerStatus[playerid]);
        
giPlayerStatus[playerid] = Create3DTextLabel(szFormat,0x68EA6CFF,1.0,1.0,1.0,15.0,0,1);
        
Attach3DTextLabelToPlayer(giPlayerStatus[playerid],playerid,0.0,0.0,0.3);
    }
    return 
1;
}
zcmd(qstate,playerid,params[])
{
    
Delete3DTextLabel(giPlayerStatus[playerid]);
    
giPlayerStatus[playerid] = Text3D:-1;
    
SendClientMessageEx(playerid,COLOR_GRAD2,"State have been removed.");
    return 
1;

Reply
#4

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Hello!

Try this:
PHP код:
new Text3D:giPlayerStatus[MAX_PLAYERS] = {-1,...};
zcmd(state,playerid,params[])
{
    if(!
sscanf(params,"s[32]",params[0]))
    {
        new 
szFormat[50];
        
format(szFormat,sizeof szFormat,"State: %s.",params[0]);
        
SendClientMessageEx(playerid,COLOR_GRAD2,szFormat);
        
Delete3DTextLabel(giPlayerStatus[playerid]);
        
giPlayerStatus[playerid] = Create3DTextLabel(szFormat,0x68EA6CFF,1.0,1.0,1.0,15.0,0,1);
        
Attach3DTextLabelToPlayer(giPlayerStatus[playerid],playerid,0.0,0.0,0.3);
    }
    return 
1;
}
zcmd(qstate,playerid,params[])
{
    
Delete3DTextLabel(giPlayerStatus[playerid]);
    
giPlayerStatus[playerid] = -1;
    
SendClientMessageEx(playerid,COLOR_GRAD2,"State have been removed.");
    return 
1;

(43973) : warning 213: tag mismatch:

line
:

Код:
giPlayerStatus[playerid] = -1;
Reply
#5

PHP код:
giPlayerStatus[playerid] = -1
to
PHP код:
giPlayerStatus[playerid] = Text3D:-1
Reply
#6

Quote:
Originally Posted by Mencent
Посмотреть сообщение
PHP код:
giPlayerStatus[playerid] = -1
to
PHP код:
giPlayerStatus[playerid] = Text3D:-1
warning 213: tag mismatch:

Код:
new Text3D:giPlayerStatus[MAX_PLAYERS] = {-1,...};
Reply
#7

Put it at Defines area
PHP код:
#undef INVALID_3DTEXT_ID                                                        
#define INVALID_3DTEXT_ID Text3D:0xFFFF 
And
PHP код:
new Text3D:giPlayerStatus[MAX_PLAYERS] = {-1,...}; 
Replace it with
PHP код:
new Text3D:giPlayerStatus[MAX_PLAYERS] = {INVALID_3DTEXT_ID, ...}; 
And
PHP код:
giPlayerStatus[playerid] = Text3D:-1
Replace it with
PHP код:
giPlayerStatus[playerid] = INVALID_3DTEXT_ID
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)