AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   type mismatch (https://forums.alliedmods.net/showthread.php?t=214086)

cstrike37 04-22-2013 21:21

type mismatch
 
I keep getting this error when compiling, it's kinda getting annoying now.
PHP Code:

error 035argument type mismatch <argument 4

Can someone help me how to fix it?

PHP Code:

public DeathMsg()
{
    new 
kid read_data(1)
    new 
vid read_data(2)
    
    if( 
kid == vid )
        return 
PLUGIN_CONTINUE;
    if( !
g_bIsVipvid ] )
        return 
PLUGIN_CONTINUE;
    new 
pnumplayers[32]
    
get_playersplayerspnum )
    for( new 
itidpnumi++ )
    {
        
tid players[i]
        
emit_sound(tidCHAN_VOICE"spk %s",die_spk[random(2)], VOL_NORMATTN_NORM0PITCH_NORM)
    }

    return 
PLUGIN_CONTINUE;



^SmileY 04-22-2013 21:47

Re: type mismatch
 
die_spk[random(2)] ??

Its not a random(SOME_TAG) ??

For best help post the full code

ConnorMcLeod 04-23-2013 00:15

Re: type mismatch
 
PHP Code:

        tid players[i]
        
emit_sound(tidCHAN_VOICE"spk %s",die_spk[random(2)], VOL_NORMATTN_NORM0PITCH_NORM

->

PHP Code:

        emit_sound(players[i], CHAN_VOICEdie_spk[random(2)], VOL_NORMATTN_NORM0PITCH_NORM

-don't need to cache players[i] in a var if you use it once.
-you can't format a string in emit_sound native, pass directly the sound name because you don't need spk command (your problem was there).
-last, you may want to add "a" flag to get_players so you only retrieve a list of alive players.

cstrike37 04-24-2013 00:44

Re: type mismatch
 
Alright thanks!
And is there a way to make only the close player hear the sound?
When hes near the person that got killed he will hear the death sound (like 2000 radius away)


All times are GMT -4. The time now is 10:48.

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