Forcing commands
#1

Well Hi,
In my gamemode, There is a command called /pc which shows the "Player Colors" when executed. Now, I need a command which should force a player to read it when we execute a command called /fpc.
Example : /fr (Playername / ID ) = /fr 2. When this is executed, On Player ID 2's screen, The player color should automatically appear in dialog.

Код:
/pc command :
dcmd_pc(playerid,params[])
{
	#pragma unused params
	new string[128];
    if(IsSpawned[playerid] != 1)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
        return 1;
	}
	ShowPlayerDialog(playerid,DIALOG_PC,DIALOG_STYLE_MSGBOX,"{FF0000}Player Colours","{228B22}This green is for Army Personnel and Medics.\n{0000FF}This blue is for police.\n{FF4500}This orange is for CIA.\n{556B2F}This green is for Drivers.\n{FFA500}This orange is for medium wanted players.\n{FFFF00}This yellow is for low wanted players.\n{FF0000}This red is for most wanted players.\n{FFFFFF}This white is for civilians. Police must not shoot these players.","Ok","Cancel");

	format(string,sizeof(string),"[ADMIN SPY] %s(%d) has typed /pc.",PlayerName(playerid),playerid);
	SendClientMessageToAllAdmins(string);

	format(string,sizeof(string),"4[ADMIN SPY] %s(%d) has typed /pc.",PlayerName(playerid),playerid);
	IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string);
	return 1;
}
I'd appreciate your replies on this topic.
Thanks.
Reply
#2

Try this. You need SSCANF for that.
pawn Код:
dcmd_fpc(playerid,params[])
{
    new pID;
    if(sscanf(params,"u",pID)) return SendClientMessage(playerid,0xFFFFFFFF,"USAGE: /fpc [playerid]");
    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,0xCCCCCCFF,"Player is not connected.");
    if(!IsSpawned[playerid]) return SendClientMessage(playerid,COLOR_ERROR,"Player must be alive and spawned.");
    ShowPlayerDialog(pID,DIALOG_PC,DIALOG_STYLE_MSGBOX,"{FF0000}Player Colours","{228B22}This green is for Army Personnel and Medics.\n{0000FF}This blue is for police.\n{FF4500}This orange is for CIA.\n{556B2F}This green is for Drivers.\n{FFA500}This orange is for medium wanted players.\n{FFFF00}This yellow is for low wanted players.\n{FF0000}This red is for most wanted players.\n{FFFFFF}This white is for civilians. Police must not shoot these players.","Ok","Cancel");
   
    format(string,sizeof(string),"[ADMIN SPY] %s(%d) has typed /fpc on %s",PlayerName(playerid),playerid,PlayerName(pID));
    SendClientMessageToAllAdmins(string);

    format(string,sizeof(string),"4[ADMIN SPY] %s(%d) has typed /fpc on %s",PlayerName(playerid),playerid,PlayerName(pID));
    IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string);
    return 1;
}
Reply
#3

Thanks..
Reply
#4

Edited few things above, copy newer one.
Reply
#5

Код:
C:\Users\Bing\Desktop\samp\gamemodes\extremetester.pwn(9807) : error 017: undefined symbol "string"
C:\Users\Bing\Desktop\samp\gamemodes\extremetester.pwn(9807) : error 017: undefined symbol "string"
C:\Users\Bing\Desktop\samp\gamemodes\extremetester.pwn(9807) : error 029: invalid expression, assumed zero
C:\Users\Bing\Desktop\samp\gamemodes\extremetester.pwn(9807) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Код:
Line 9807 :format(string,sizeof(string),"[ADMIN SPY] %s(%d) has used /fpc on %s",PlayerName(playerid),playerid,PlayerName(pID));
Line 9808 :	SendClientMessageToAllAdmins(string);
""""" 9809
Line 9810 :	format(string,sizeof(string),"4[ADMIN SPY] %s(%d) has used /fpc on",PlayerName(playerid),playerid,PlayerName(pID));
Line 9811 :	IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string);
Line 9812 :           return 1;
Reply
#6

Код:
new string[0x5E];
Reply
#7

Add this below new pID;

pawn Код:
new string[128];
Reply
#8

Alright, Everything is working fine. This command is only for players who have regular player stats, I made that function. Last problem is. When that command is executed, The server should automatically echo the message
Example :
"Regular Player %s has forced player colors on %s."
I tried like this
pawn Код:
dcmd_fpc(playerid,params[])
{
    new pID;
    new string[128];
    if(IsRegularPlayer[playerid] != 1337)
    {
        SendClientMessage(playerid,COLOR_ERROR,"Only Regular Players can use the Regular Player chat to talk.");
        return 1;
    }
    if(sscanf(params,"u",pID)) return SendClientMessage(playerid,0xFFFFFFFF,"USAGE: /fpc (playerid)");
    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,0xCCCCCCFF,"Player is not connected.");
    if(!IsSpawned[playerid]) return SendClientMessage(playerid,COLOR_ERROR,"Player must be alive and spawned.");
    ShowPlayerDialog(pID,DIALOG_PC,DIALOG_STYLE_MSGBOX,"{FF0000}Player Colours","{228B22}This green is for Army Personnel and Medics.\n{0000FF}This blue is for police.\n{FF4500}This orange is for CIA.\n{556B2F}This green is for Drivers.\n{FFA500}This orange is for medium wanted players.\n{FFFF00}This yellow is for low wanted players.\n{FF0000}This red is for most wanted players.\n{FFFFFF}This white is for civilians. Police must not shoot these players.","Ok","Cancel");
   
    format(string,sizeof(string),"[ADMIN SPY] %s(%d) has typed /fpc on %s",PlayerName(playerid),playerid,PlayerName(pID));
    SendClientMessageToAllAdmins(string);

    format(string,sizeof(string),"Regular Player %s has forced player colors on %s.
    SendClientMessageToAllRegulars(string);

    format(string,sizeof(string),"
4[ADMIN SPY] %s(%d) has typed /fpc on %s",PlayerName(playerid),playerid,PlayerName(pID));
    IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string);
    return 1;
}
Compiling time :
Код:
C:\Users\Bing\Desktop\samp\gamemodes\extremetester.pwn(9816) : error 037: invalid string (possibly non-terminated string)
C:\Users\Bing\Desktop\samp\gamemodes\extremetester.pwn(9816) : error 017: undefined symbol "Regular"
C:\Users\Bing\Desktop\samp\gamemodes\extremetester.pwn(9816) : error 017: undefined symbol "s"
C:\Users\Bing\Desktop\samp\gamemodes\extremetester.pwn(9816) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#9

Here you go!
pawn Код:
dcmd_fpc(playerid,params[])
{
    new pID;
    new string[128];
    if(IsRegularPlayer[playerid] != 1337)
    {
        SendClientMessage(playerid,COLOR_ERROR,"Only Regular Players can use the Regular Player chat to talk.");
        return 1;
    }
    if(sscanf(params,"u",pID)) return SendClientMessage(playerid,0xFFFFFFFF,"USAGE: /fpc (playerid)");
    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,0xCCCCCCFF,"Player is not connected.");
    if(!IsSpawned[playerid]) return SendClientMessage(playerid,COLOR_ERROR,"Player must be alive and spawned.");
    ShowPlayerDialog(pID,DIALOG_PC,DIALOG_STYLE_MSGBOX,"{FF0000}Player Colours","{228B22}This green is for Army Personnel and Medics.\n{0000FF}This blue is for police.\n{FF4500}This orange is for CIA.\n{556B2F}This green is for Drivers.\n{FFA500}This orange is for medium wanted players.\n{FFFF00}This yellow is for low wanted players.\n{FF0000}This red is for most wanted players.\n{FFFFFF}This white is for civilians. Police must not shoot these players.","Ok","Cancel");

    format(string,sizeof(string),"[ADMIN SPY] %s(%d) has typed /fpc on %s",PlayerName(playerid),playerid,PlayerName(pID));
    SendClientMessageToAllAdmins(string);

    format(string,sizeof(string),"Regular Player %s has forced player colors on %s.",PlayerName(playerid),PlayerName(pID));
    SendClientMessageToAllRegulars(string);

    format(string,sizeof(string),"4[ADMIN SPY] %s(%d) has typed /fpc on %s",PlayerName(playerid),playerid,PlayerName(pID));
    IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)