how to make all player know that player use cmd..
#1

hi ..all sorry fo rmy bad english..



can some one teach me ..

example:
See The Attachments..
sorry i cant explain it..because i dont know how to say it..
Reply
#2

If you want, that all players know that, make this:

Код:
public OnPlayerCommandText(playerid,cmdtext[])
{
    new string[128],cmd[32],pos=strfind(cmdtext," ");
    strmid(cmd,cmdtext,0,(pos == -1)?strlen(cmdtext):pos);
    format(string,128,"* %s used %s",GetName(playerid),cmd);
    SendClientMessageToAll(-1,string);
}

stock GetName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    return name;
}
Greekz
Reply
#3

i get this error..\

PHP код:
C:\Users\Acer\Desktop\SAMP\pawno\BCRv2.pwn(323) : error 021symbol already defined"cmd"
C:\Users\Acer\Desktop\SAMP\pawno\BCRv2.pwn(330) : warning 219local variable "string" shadows a variable at a preceding level
C
:\Users\Acer\Desktop\SAMP\pawno\BCRv2.pwn(338) : warning 219local variable "string" shadows a variable at a preceding level
C
:\Users\Acer\Desktop\SAMP\pawno\BCRv2.pwn(346) : warning 219local variable "string" shadows a variable at a preceding level
C
:\Users\Acer\Desktop\SAMP\pawno\BCRv2.pwn(354) : warning 219local variable "string" shadows a variable at a preceding level
C
:\Users\Acer\Desktop\SAMP\pawno\BCRv2.pwn(362) : warning 219local variable "string" shadows a variable at a preceding level
C
:\Users\Acer\Desktop\SAMP\pawno\BCRv2.pwn(370) : warning 219local variable "string" shadows a variable at a preceding level
C
:\Users\Acer\Desktop\SAMP\pawno\BCRv2.pwn(319) : warning 204symbol is assigned a value that is never used"tmp"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
1 Error

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    new 
tmp[128]; //319
    
new cmd[256];
    new 
idx;
    
cmd strtok(cmdtextidx);
      new 
string[128],cmd[32],pos=strfind(cmdtext," ");  //323
    
strmid(cmd,cmdtext,0,(pos == -1)?strlen(cmdtext):pos);
    
format(string,128,"* %s used %s",GetName(playerid),cmd);
    
SendClientMessageToAll(-1,string);
    if(!
strcmp("/aslm"cmdtexttrue))
    {
    new 
name[128],string[128]; //330
    
GetPlayerName(playerid,name,128);
    
format(stringsizeof(string), "{00C0FF}%s {FF00EA}' {F3FF02}Assalamualaikum{FF00EA}' {FFAF00}!",name);
    
SendClientMessageToAll(0xAFAFAFAAstring);
    return 
1;
    }
    if(!
strcmp("/wslm"cmdtexttrue))
    {
    new 
name[128],string[128]; //338
    
GetPlayerName(playerid,name,128);
    
format(stringsizeof(string), "{00C0FF}%s {FF00EA}' {F3FF02}Waalaikumussalam{FF00EA}' {FFAF00}!",name);
    
SendClientMessageToAll(0xAFAFAFAAstring);
    return 
1;
    }
    if(!
strcmp("/ty"cmdtexttrue))
    {
    new 
name[128],string[128]; //346
    
GetPlayerName(playerid,name,128);
    
format(stringsizeof(string), "{00C0FF}%s {FF00EA}' {F3FF02}Thank You!{FF00EA}' {FFAF00}!",name);
    
SendClientMessageToAll(0xAFAFAFAAstring);
    return 
1;
    }
    if(!
strcmp("/wc"cmdtexttrue))
    {
    new 
name[128],string[128]; //354
    
GetPlayerName(playerid,name,128);
    
format(stringsizeof(string), "{00C0FF}%s {FF00EA}' {F3FF02}You're Welcome!{FF00EA}' {FFAF00}!",name);
    
SendClientMessageToAll(0xAFAFAFAAstring);
    return 
1;
    }
    if(!
strcmp("/wb"cmdtexttrue))
    {
    new 
name[128],string[128]; //362
    
GetPlayerName(playerid,name,128);
    
format(stringsizeof(string), "{00C0FF}%s {FF00EA}' {F3FF02}Welcome Back!{FF00EA}' {FFAF00}!",name);
    
SendClientMessageToAll(0xAFAFAFAAstring);
    return 
1;
    }
    if(!
strcmp("/bye"cmdtexttrue))
    {
    new 
name[128],string[128]; //370
    
GetPlayerName(playerid,name,128);
    
format(stringsizeof(string), "{00C0FF}%s {FF00EA}' {F81414}Bye!!{FF00EA}' {FFAF00}!",name);
    
SendClientMessageToAll(0xAFAFAFAAstring);
    return 
1;
    }
    if (
strcmp("/cmds"cmdtexttrue10) == 0)
    {
        
ShowPlayerDialog(playerid123DIALOG_STYLE_LIST"BCR Command List""Player Commands\nText Commands\nTeleport Commands\nVIP Level 1 Commands\nVIP Level 2 Commands\nVIP Level 3 Commands\nServer Info""Select""Exit");
        return 
1;
    }
    if(
strcmp(cmdtext"/afk"true) == 0)
    {
        
SendClientMessage(playerid0xAFAFAFAA,"<<< You are now afk ( Away from Keyboard ), type /back to move again >>>");
        
TogglePlayerControllable(playerid,0);
        new 
string1[128];
        new 
name[MAX_PLAYER_NAME];
        
GetPlayerName(playeridnamesizeof(name));
        
format(string1,sizeof(string1), "<<< %s is now afk ( Away from Keyboard ) >>>"name);
        
SendClientMessageToAll(Bluestring1);
        return 
1;
    }
    if (
strcmp("/rules"cmdtexttrue10) == 0)
    {
        
ShowPlayerDialog(playerid1DIALOG_STYLE_MSGBOX"Server Rules""- No Hack\n- No Spamming\n- No Cheating\n Allowed Cheat:Surfly,Repair Car,Flip\n- Respect Admins\n\nDo you agree to these rules?""Yes""No");
        return 
1;
    }
    if(!
strcmp(cmdtext"/me"true3))
    {
        if(!
cmdtext[3])return SendClientMessage(playerid0xAFAFAFAA"[Server Message]: /me [action]");
        new 
str[128];
        
GetPlayerName(playeridstrsizeof(str));
        
format(strsizeof(str), "* %s %s *"strcmdtext[4]);
        
SendClientMessageToAll(0xA8A8FFAAstr);
        return 
1;
    }
    if(
strcmp(cmd"/kill"true) == 0)
    {
        
SetPlayerHealth(playerid0);
        
SpawnPlayer(playerid);
        return 
1;
    }
    if(
strcmp(cmdtext"/back"true) == 0)
    {
        
SendClientMessage(playerid0xAFAFAFAA,"<<< You are no longer afk ( Away from Keyboard ) >>>");
        
TogglePlayerControllable(playerid1);
        new 
string1[128];
        new 
name[MAX_PLAYER_NAME];
        
GetPlayerName(playeridnamesizeof(name));
        
format(string1,sizeof(string1), "<<< %s is no longer afk ( Away from Keyboard ) >>>"name);
        
SendClientMessageToAll(Bluestring1);
        return 
1;
    }
    if (
strcmp("/stream"cmdtexttrue10) == 0)
    {
        
ShowPlayerDialog(playerid999DIALOG_STYLE_LIST"Music Streamer Ver.2.0","Stream For Self\nStream For Other Player (V.I.P Only)""Select""Cancel");
        return 
1;
    }
    if (
strcmp("/chatcolour"cmdtexttrue) == || strcmp("/ccol"cmdtexttrue) == 0)
    {
        
ShowPlayerDialog(playerid,20,DIALOG_STYLE_LIST,"{FFCC00}Choose the colour for your name.","{33CC00}Green\r\n{FF0000}Red\r\n{FFCC00}Orange\n{CC66CC}Purple\n{FFFFFF}White\n{000000}Black\n{3333FF}Blue","Okay""Not okay");
        return 
1;
    }
    if (
strcmp("/dragtrack"cmdtexttrue10) == 0)
    {
        
SetPlayerInterior(playerid0);
        
SetPlayerPos(playerid1007.52425.010.6);
        return 
1;
    }
    if (
strcmp(cmdtext"/arch"true) == 0)
    {
        if (
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            
SetVehiclePos(GetPlayerVehicleID(playerid), -2704.4775,217.2848,3.8375);
            
SetVehicleZAngle(GetPlayerVehicleID(playerid), 90);
        }
        else
        {
            
SetPlayerPos(playerid, -2714.2739,204.8123,4.3281);
            
SetPlayerFacingAngle(playerid0);
        }
        
SetCameraBehindPlayer(playerid);
        return 
1;
    }
    if (
strcmp(cmdtext"/trans"true) == 0)
    {
        if (
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            
SetVehiclePos(GetPlayerVehicleID(playerid), -1936.360839225.12030033.814777);
            
SetVehicleZAngle(GetPlayerVehicleID(playerid), 357.421691);
        }
        else
        {
            
SetPlayerPos(playerid, -1936.360839225.12030033.814777);
            
SetPlayerFacingAngle(playerid357.421691);
        }
        
SetCameraBehindPlayer(playerid);
        return 
1;
    }
    if (
strcmp("/about"cmdtexttrue10) == 0)
    {
        
ShowPlayerDialog(playerid645DIALOG_STYLE_LIST"BCR Server Info""Gamemode Name:BCR GM V2.0\nGamemode Version:V2\nOwner:Aiman Zack\nCo-Owner:Sahrul012,Firdaus\nAdmins:\nVIPs:\nBest Player:""Exit""");
        return 
1;
    }
    if (
strcmp("/fstyle"cmdtexttrue10) == 0)
    {
        
ShowPlayerDialog(playerid206DIALOG_STYLE_LIST"Fighting Styles""Elbow\nBoxing\nGrabkick\nKneehead\nKungfu\nNormal""Select""Cancel");
        return 
1;
    }
    if (
strcmp("/shh"cmdtexttrue10) == 0)
    {
        
StopAudioStreamForPlayer(playerid);
        return 
1;
    }
    if (
strcmp("/teleport"cmdtexttrue10) == 0)
    {
       
ShowPlayerDialog(playerid400DIALOG_STYLE_LIST"Teleport Categories""Los Santos\nSan Fierro\nLas Venturas\nOther""Select""Cancel");
       return 
1;
    }
    return 
0;
}
//---------// 
hope you understand it..
Reply
#4

Ok, when you post it there, just write it like this:

Код:
format(tmp,128,"* %s used %s",GetName(playerid),cmd); 
SendClientMessageToAll(-1,tmp);
Greekz
Reply
#5

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Ok, when you post it there, just write it like this:

Код:
format(tmp,128,"* %s used %s",GetName(playerid),cmd); 
SendClientMessageToAll(-1,tmp);
Greekz
put it under
this code?
PHP код:
new tmp[128]; //319
    
new cmd[256];
    new 
idx;
    
cmd strtok(cmdtextidx); 
Reply
#6

Thanks Kaliber..

it solved......


+1rep...


Thanks So Much...
Reply
#7

Quote:
Originally Posted by sahrul012
Посмотреть сообщение
put it under
this code?
Yes exactly there where u put my old code
Reply
#8

Thanks Kaliber..

It Solved
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)