SA-MP Forums Archive
a /do problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: a /do problem (/showthread.php?tid=349911)



a /do problem - [LSG]Lil_Familie - 10.06.2012

i have 1 error on this code

PHP код:
CMD:do(playeridparams[])
{
        new 
str[128], name[MAX_PLAYER_NAME];
        if (
sscanf(params"s[128]"str)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /do [action]");
        {
            
GetPlayerName(playeridnamesizeof(name));
            
format(strsizeof(str), "* %s (( %s ))"params[0], name);
            
ProxDetector(3.5playerid,  str,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        return 
1;

it says it appears in this line:

PHP код:
ProxDetector(3.5playerid,  str,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); 
this is the error

PHP код:
C:\Users\Patrick\Desktop\Samp scriptin\filterscripts\rp_cmds.pwn(135) : error 029invalid expressionassumed zero 



Re : a /do problem - ricardo178 - 10.06.2012

Stop fucking bumping.......... You will be banned if you continue.

Anyways:

pawn Код:
ProxDetector(3.5, playerid, str, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
Make sure you have this in your script:

pawn Код:
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
            {
                GetPlayerPos(i, posx, posy, posz);
                tempposx = (oldposx -posx);
                tempposy = (oldposy -posy);
                tempposz = (oldposz -posz);
                if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) // If the player is within 16 meters
                {
                    SendClientMessage(i, col1, string);
                }
                else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) // within 8 meters
                {
                    SendClientMessage(i, col2, string);
                }
                else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) //4 meters
                {
                    SendClientMessage(i, col3, string);
                }
                else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) //2 meters
                {
                    SendClientMessage(i, col4, string);
                }
                else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) //1 meter
                {
                    SendClientMessage(i, col5, string);
                }
            }
            else
            {
                SendClientMessage(i, col1, string);
            }
        }
    }
    return 1;
}



AW: a /do problem - [LSG]Lil_Familie - 10.06.2012

always when i put this in my gamemode i cant run my server but i aint got any errors

PHP код:
CMD:o(playeridparams[])
{
        new 
str[128], name[MAX_PLAYER_NAME];
        if (
sscanf(params"s[128]"str)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /o(oc) [chat]");
        {
            
GetPlayerName(playeridnamesizeof(name));
            
format(strsizeof(str), "[OOC] %s: %s"nameparams[0]);
            
SendClientMessageToAll(COLOR_YELLOWstr);
        }
        return 
1;
}
CMD:ooc(playeridparams[])
{
        return 
cmd_o(playeridparams);
}
CMD:kill(playeridparams[])
{
        
SetPlayerHealth(playerid0);
        
SetPlayerArmour(playerid0);
}
CMD:me(playeridparams[])
{
        new 
str[128], name[MAX_PLAYER_NAME];
        if (
sscanf(params"s[128]"str)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /me [action]");
        {
            
GetPlayerName(playeridnamesizeof(name));
            
format(strsizeof(str), "* %s: %s"nameparams[0]);
            
ProxDetector(3.5playeridstr,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        return 
1;
}
CMD:do(playeridparams[])
{
        new 
str[128], name[MAX_PLAYER_NAME];
        if (
sscanf(params"s[128]"str)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /do [action]");
        {
            
GetPlayerName(playeridnamesizeof(name));
            
format(strsizeof(str), "* %s (( %s ))"params[0], name);
            
ProxDetector(3.5playeridstr,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        return 
1;
}
CMD:b(playeridparams[])
{
        new 
str[128], name[MAX_PLAYER_NAME];
        if (
sscanf(params"s[128]"str)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /b [message]");
        {
            
GetPlayerName(playeridnamesizeof(name));
            
format(strsizeof(str), "%s: %s"nameparams[0]);
            
ProxDetector(3.5playeridstrCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        return 
1;
}
ProxDetector(Float:radiplayeridstring[],col1,col2,col3,col4,col5)
{
    if(
IsPlayerConnected(playerid))
    {
        new 
Float:posxFloat:posyFloat:posz;
        new 
Float:oldposxFloat:oldposyFloat:oldposz;
        new 
Float:tempposxFloat:tempposyFloat:tempposz;
        
GetPlayerPos(playeridoldposxoldposyoldposz);
        for(new 
0MAX_PLAYERSi++)
        {
            if(
IsPlayerConnected(i))
            {
                
GetPlayerPos(iposxposyposz);
                
tempposx = (oldposx -posx);
                
tempposy = (oldposy -posy);
                
tempposz = (oldposz -posz);
                if(
GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
                {
                    if (((
tempposx radi/16) && (tempposx > -radi/16)) && ((tempposy radi/16) && (tempposy > -radi/16)) && ((tempposz radi/16) && (tempposz > -radi/16)))
                    {
                        
SendClientMessage(icol1string);
                    }
                    else if (((
tempposx radi/8) && (tempposx > -radi/8)) && ((tempposy radi/8) && (tempposy > -radi/8)) && ((tempposz radi/8) && (tempposz > -radi/8)))
                    {
                        
SendClientMessage(icol2string);
                    }
                    else if (((
tempposx radi/4) && (tempposx > -radi/4)) && ((tempposy radi/4) && (tempposy > -radi/4)) && ((tempposz radi/4) && (tempposz > -radi/4)))
                    {
                        
SendClientMessage(icol3string);
                    }
                    else if (((
tempposx radi/2) && (tempposx > -radi/2)) && ((tempposy radi/2) && (tempposy > -radi/2)) && ((tempposz radi/2) && (tempposz > -radi/2)))
                    {
                        
SendClientMessage(icol4string);
                    }
                    else if (((
tempposx radi) && (tempposx > -radi)) && ((tempposy radi) && (tempposy > -radi)) && ((tempposz radi) && (tempposz > -radi)))
                    {
                        
SendClientMessage(icol5string);
                    }
                }
            }
        }
    }
    return 
1;




Re : a /do problem - ricardo178 - 10.06.2012

This:
pawn Код:
CMD:do(playerid, params[])
{
    new text[128], str[128], name[MAX_PLAYER_NAME];
    if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /do [action]");
    {
        GetPlayerName(playerid, name, sizeof(name));
        format(str, sizeof(str), "* %s (( %s ))", text, name);
        ProxDetector(3.5, playerid,  str,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
    return 1;
}



AW: a /do problem - [LSG]Lil_Familie - 11.06.2012

okay i fixed it