Whisper script
#1

Hi,Can someone make me a script for /w (message) ...The players must be close to the player who is typing /w .If the distance between them is high then the other player won't see the message.Please help me.
Reply
#2

pawn Код:
COMMAND:w(playerid,params[])
{
   new string[250];
   if(sscanf(params,"s[250]",string)) return SendClientMessage(playerid,COLOR_RED,"USAGE:/w [message]");
   SetPlayerChatBubble(playerid,string,COLOR_YELLOW,35,10000);
   new Float:x,Float:y,Float:z;
   GetPlayerPos(playerid,x,y,z);
   new pName[24];
   GetPlayerName(playerid,pName,sizeof(pName));
   new string2[250];
   format(string2,sizeof(string2),"%s(%d):%s",pName,playerid,string);
   for(new i=0;i<=MAX_PLAYERS;i++)
   {
     if(IsPlayerInRangeOfPoint(i,15.0,x,y,z)) return SendClientMessage(playerid,COLOR_YELLOW,string2);
   }
 return 1;
}
Reply
#3

After adding Cjgogo's code my other commands are not working.These are my commands.When I type /mycommand it shows SERVER:Unknown command.I removed Cjgogo's code from my script but it still don't works please help
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/kill", cmdtext, true, 10) == 0)
	{
	    ClearAnimations(playerid,5);
		SetPlayerHealth(playerid,0);
		SendClientMessage(playerid,COLOR_YELLOW,"You have commited a sucide");
		SetPlayerScore(playerid, GetPlayerScore(playerid) - 2);
		new msg[128],
		suicider[MAX_PLAYER_NAME];
		GetPlayerName(playerid, suicider, sizeof suicider);
		format(msg, sizeof(msg), "%s has commited suicide!", suicider);
		SendClientMessageToAll(COLOR_RED, msg);
		return 1;
	}
	if (strcmp("/sync", cmdtext, true, 10) == 0)
	{
		ClearAnimations(playerid,5);
		SendClientMessage(playerid,COLOR_YELLOW,"If you are still bugged then ask adminis to help you.If there is not admins then please relog and report about the bug in forums.");
	}
	if (strcmp("/bodyguard", cmdtext, true, 10) == 0)
    {
       ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Bodyguard", "Bodyguard's job is to protect a player who called for a bodyguard.You will get money for this from the player who called you", "Ok", "Cancle");
    }
	//Animations
    if (strcmp("/handsup", cmdtext, true, 10) == 0)
    {
    	SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
    }
    if (strcmp("/sit", cmdtext, true, 10) == 0)
    {
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_SITTING);
    }
    if (strcmp("/smoke", cmdtext, true, 10) == 0)
    {
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_SMOKE_CIGGY);
    }
    if (strcmp("/anims", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"/handsup /sit /call /smoke");
    }
	return 0;
}
Reply
#4

ZCMD doesn't support strcmp and OnPlayerCommandText use zcmd and convert the strcmp to ZCMD
Reply
#5

So what should i do now I removed cjgogo's code but my other commands are not working too..Please help dude plz and I am using pawno to script
Reply
#6

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/kill", cmdtext, true, 10) == 0)
    {
        ClearAnimations(playerid,5);
        SetPlayerHealth(playerid,0);
        SendClientMessage(playerid,COLOR_YELLOW,"You have commited a sucide");
        SetPlayerScore(playerid, GetPlayerScore(playerid) - 2);
        new msg[128],
        suicider[MAX_PLAYER_NAME];
        GetPlayerName(playerid, suicider, sizeof suicider);
        format(msg, sizeof(msg), "%s has commited suicide!", suicider);
        SendClientMessageToAll(COLOR_RED, msg);
        return 1;
    }
    if (strcmp("/sync", cmdtext, true, 10) == 0)
    {
        ClearAnimations(playerid,5);
        SendClientMessage(playerid,COLOR_YELLOW,"If you are still bugged then ask adminis to help you.If there is not admins then please relog and report about the bug in forums.");
        return 1;
    }
    if (strcmp("/bodyguard", cmdtext, true, 10) == 0)
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Bodyguard", "Bodyguard's job is to protect a player who called for a bodyguard.You will get money for this from the player who called you", "Ok", "Cancle");
        return 1;
    }
    //Animations
    if (strcmp("/handsup", cmdtext, true, 10) == 0)
    {
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
        return 1;
    }
    if (strcmp("/sit", cmdtext, true, 10) == 0)
    {
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_SITTING);
        return 1;
    }
    if (strcmp("/smoke", cmdtext, true, 10) == 0)
    {
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_SMOKE_CIGGY);
        return 1;
    }
    if (strcmp("/anims", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"/handsup /sit /call /smoke");
        return 1;
    }
    return 0;
}
this should work now
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)