Help whith /whisper
#1

Can some one give me the code for /w , /whisper

I have a whisper that i can whisper something to someone only if i am near him

i want it to work even if i am in LS and he its in SF

Sorry for my english, i hope you understand me..
Reply
#2

Can you show me your current /w command? Then i'll be able to change it for you.
Reply
#3

i have 2 commands

/whisper - /w -> i dont know if it works, i have added it now
and
/whisper2 - /w2 -> default gm command with distance

PHP код:
// Whisper
if(strcmp(cmd"/whisper"true) == || strcmp(cmd"/w"true) == 0)
    {
      if(
IsPlayerConnected(playerid))
      {
        if(
gPlayerLogged[playerid] == 0)
        {
          
SendClientMessage(playeridCOLOR_GREY"  You havent logged in yet !");
          return 
1;
        }
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USAGE: (/w)hisper [playerid/PartOfName] [whisper text]");
                return 
1;
            }
            
giveplayerid ReturnUser(tmp);
            if (
IsPlayerConnected(giveplayerid))
            {
              if(
giveplayerid != INVALID_PLAYER_ID)
              {
                if(
HidePM[giveplayerid] > 0)
                {
                  
SendClientMessage(playeridCOLOR_GREY"  That player is blocking Whispers !");
                  return 
1;
                }
                    
GetPlayerName(playeridsendernamesizeof(sendername));
                    
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
                    if(
giveplayerid == playerid)
                    {
                        
format(stringsizeof(string), "* %s sopteste ceva."sendername);
                        
ProxDetector(5.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    }
                    new 
length strlen(cmdtext);
                    while ((
idx length) && (cmdtext[idx] <= ' '))
                    {
                        
idx++;
                    }
                    new 
offset idx;
                    new 
result[64];
                    while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
                    {
                        
result[idx offset] = cmdtext[idx];
                        
idx++;
                    }
                    
result[idx offset] = EOS;
                    if(!
strlen(result))
                    {
                        
SendClientMessage(playeridCOLOR_GRAD2"USAGE: (/w)isper [playerid/PartOfName] [whisper text]");
                        return 
1;
                    }
                    
format(stringsizeof(string), "%s(ID: %d) sopteste: %s"sendernameplayerid, (result));
                    
SendClientMessage(giveplayeridCOLOR_BLUEstring);
                    
format(stringsizeof(string), "Mesaj trimis catre %s(ID: %d)."giveplayergiveplayerid);
                    
SendClientMessage(playeridCOLOR_BLUEstring);
                    
SBizzInfo[2][sbTill] += txtcost 2;
                    
ExtortionSBiz(2txtcost 2);
                    return 
1;
                }
            }
            else
            {
                    
format(stringsizeof(string), "  %d is not an active player."giveplayerid);
                    
SendClientMessage(playeridCOLOR_GRAD1string);
            }
        }
        return 
1;
    }
//----------------------------------[Whisper]-----------------------------------------------
    
if(strcmp(cmd"/whisper2"true) == || strcmp(cmd"/w2"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
gPlayerLogged[playerid] == 0)
            {
                
SendClientMessage(playeridCOLOR_GREY"   You havent logged in yet!");
                return 
1;
            }
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USAGE: (/w)hisper [playerid/PartOfName] [whisper text]");
                return 
1;
            }
            if (
PlayerInfo[playerid][pLevel] == 1)
            {
                
SendClientMessage(playeridCOLOR_GRAD2"Nu ai level 2 !");
                return 
1;
            }
            
giveplayerid ReturnUser(tmp);
            if (
IsPlayerConnected(giveplayerid))
            {
                if(
giveplayerid != INVALID_PLAYER_ID)
                {
                    new 
Float:xFloat:yFloat:z;
                       
GetPlayerPos(giveplayerid,x,y,z);
                    if(
PlayerToPoint(5playeridxyz))
                    {
                        
GetPlayerName(playeridsendernamesizeof(sendername));
                        
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
                        if(
giveplayerid == playerid)
                        {
                            
format(stringsizeof(string), "* %s mutters something to himself."sendername);
                            
ProxDetector(5.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        }
                        else
                        {
                            
format(stringsizeof(string), "* %s whispers something to %s"sendernamegiveplayer);
                            
ProxDetector(15.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        }
                        new 
length strlen(cmdtext);
                        while ((
idx length) && (cmdtext[idx] <= ' '))
                        {
                            
idx++;
                        }
                        new 
offset idx;
                        new 
result[64];
                        while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
                        {
                            
result[idx offset] = cmdtext[idx];
                            
idx++;
                        }
                        
result[idx offset] = EOS;
                        if(!
strlen(result))
                        {
                            
SendClientMessage(playeridCOLOR_GRAD2"USAGE: (/w)isper [playerid/PartOfName] [whisper text]");
                            return 
1;
                        }
                        
format(stringsizeof(string), "%s sopteste: %s"sendername, (result));
                        
SendClientMessage(giveplayeridCOLOR_YELLOWstring);
                        
format(stringsizeof(string), "%s sopteste: %s"sendername, (result));
                        
SendClientMessage(playerid,  COLOR_YELLOWstring);
                        return 
1;
                    }
                    else
                    {
                        
SendClientMessage(playerid,  COLOR_GREY"    Player is not near you !");
                        return 
1;
                    }
                }
            }
            else
            {
                    
format(stringsizeof(string), "   %d is not an active player."giveplayerid);
                    
SendClientMessage(playeridCOLOR_GRAD1string);
            }
        }
        return 
1;
    } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)