Shout command
#7

Try this

PHP код:
    if(strcmp(cmd"/shout"true) == || strcmp(cmd"/s"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
GetPlayerName(playeridsendernamesizeof(sendername));
            new 
length strlen(cmdtext);
            while ((
idx length) && (cmdtext[idx] <= ' '))
            {
                
idx++;
            }
            new 
offset idx;
            new 
result[MAX_PARAM_LENGTH];
            while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
            {
                
result[idx offset] = cmdtext[idx];
                
idx++;
            }
            
result[idx offset] = EOS;
            if(!
strlen(result))
            {
                
SendClientMessage(playerid,COLOR"(/s)hout [local chat]");
                return 
1;
            }
            
format(stringsizeof(string), "%s shouts: %s!",playerid,result);
                         
ProxDetector(30.0playeridstring,WHITE,WHITE,WHITE,FADE1,FADE2);
        }
        return 
1;
    } 
PHP код:
stock ProxDetector(Float:radiplayeridstring[], col1col2col3col4col5)
{
    if(
IsPlayerConnected(playerid))
    {
        new 
Float:posxFloat:posyFloat:posz;
        new 
Float:oldposxFloat:oldposyFloat:oldposz;
        new 
Float:tempposxFloat:tempposyFloat:tempposz;
        new 
invehicle[MAX_PLAYERS];
        new 
virtualworld GetPlayerVirtualWorld(playerid);
        new 
interior GetPlayerInterior(playerid);
        new 
vehicleid GetPlayerVehicleID(playerid);
        new 
ivehicleid;
        if(
vehicleid)
        {
            
GetVehiclePos(vehicleid,oldposx,oldposy,oldposz);
        }
        else
        {
            
GetPlayerPos(playeridoldposxoldposyoldposz);
            
vehicleid GetPlayerVehicleID(playerid);
        }
        while (
strfind(stringPlayerName(playerid), false) != -&& PlayerInfo[playerid][pMask])
        {
            new 
pos strfind(stringPlayerName(playerid), false);
            
strdel(stringpospos strlen(PlayerName(playerid)));
               
strins(string"Stranger"pos258);
        }
        for(new 
0MAX_PLAYERSi++)
        {
            if(
IsPlayerConnected(i))
            {
                if(!
BigEar[i])
                {
                    if(
GetPlayerVirtualWorld(i) == virtualworld)
                    {
                        if((
GetPlayerInterior(i) == interior))
                        {
                            if(
vehicleid)
                            {
                                if(
IsPlayerInVehicle(i,vehicleid)) invehicle[i] = 1;
                            }
                            if(!
invehicle[i])
                            {
                                if(
IsPlayerInAnyVehicle(i))
                                {
                                    
ivehicleid GetPlayerVehicleID(i);
                                    
GetVehiclePos(ivehicleid,posx,posy,posz);
                                }
                                else
                                {
                                    
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))) 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);
                            }
                            else 
SendClientMessage(icol1string);
                        }
                    }
                }
                else 
SendClientMessage(icol1string);
            }
        }
    }
    return 
1;

Reply


Messages In This Thread
Shout command - by Lajko1 - 26.10.2013, 22:22
Re: Shout command - by Pottus - 26.10.2013, 22:26
Re: Shout command - by Lajko1 - 26.10.2013, 22:30
Re: Shout command - by Pottus - 26.10.2013, 22:46
Re: Shout command - by Mattakil - 26.10.2013, 23:41
Re: Shout command - by Lajko1 - 27.10.2013, 05:33
Re: Shout command - by -CaRRoT - 27.10.2013, 05:45
Re: Shout command - by Lajko1 - 27.10.2013, 07:45
Re: Shout command - by Tomix - 27.10.2013, 09:49
Re: Shout command - by Lajko1 - 27.10.2013, 13:54

Forum Jump:


Users browsing this thread: 2 Guest(s)