Help with the same command in 2 different scripts. [Really need help!]
#1

OK, I will try to explane my question:
You see, I have a /check [playerid] command, and I have a /check2 [playerid] command In Another FilterScript, Its to different commands, and I want to make something with it.
I want to script that when a player types /check [playerid], it will automaticly will write for him the /check2 [playerid], from the other filterscript.
Its like 2 different stats of the player, and I want to make these 2 CMDS as one. Is that possible? If yes please tell me how.

My /check [playerid] command:
Код:
if (strcmp(cmd, "/check", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /check [playerid]");
					return 1;
				}
	      giveplayerid = ReturnUser(tmp);
				if(IsPlayerConnected(giveplayerid))
				{
				  if(giveplayerid != INVALID_PLAYER_ID)
				  {
						ShowStats(playerid,giveplayerid);
						CallRemoteFunction("OnPlayerCommandText", "is", playerid, "/sqlcheck %s", giveplayerid);
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Invalid ID.");
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Your not an administrator.");
			}
		}
		return 1;
	}
My /check2 [playerid] command From the seconds FILTERSCRIPT:
Код:
else if(strcmp("/check2", cmd, true) == 0)
	{
	  if (!hasPermission(playerid, PER_FREEZE)) return 1;
		if(strcount(cmdtext, ' ') < 2) return SendClientMessage(playerid, COLOR_GREY,"USAGE: /sqlcheck [playername/id]");
		tmp = strtok(cmdtext, idx);
		new giveplayer = ReturnUser(tmp, playerid);
		if (IsPlayerConnected(giveplayer))
		{

			new Float:hp,Float:armour,Float:vhp;
			new ip[20];
			new ping = GetPlayerPing(giveplayer);
			new skin = GetPlayerSkin(giveplayer);
			new bullets[12];
			new weapons[12];
			new weapname[12][50];
			new handweapname[50];
			new pstate[50];
			new flag[20];
			new gender[10];
			new State = GetPlayerState(giveplayer);
			if (State == 1) pstate = "On Foot";
			else if (State == 2) pstate = "Driver";
			else if (State == 3) pstate = "Passenger";
			else if (State == 9) pstate = "Spectating";
			else pstate = "Not Available";
			if (PlayerInfo[giveplayer][pFlag] == 1) flag = "Yes";
			else if (PlayerInfo[giveplayer][pFlag] == 2) flag = "Yes-Kicked";
			else flag = "No";
			format(string,sizeof(string),"----------------------------_____[%i]%s_____----------------------------",giveplayer,PlayerInfo[giveplayer][pName]);
			SendClientMessage(playerid,COLOR_YELLOW,string);
			GetPlayerHealth(giveplayer,hp);
			GetPlayerArmour(giveplayer,armour);
			GetWeaponName(GetPlayerWeapon(giveplayer),handweapname,50);
			if (IsPlayerInAnyVehicle(giveplayer)) GetVehicleHealth(GetPlayerVehicleID(giveplayer),vhp);
			GetPlayerIp(giveplayer,ip,sizeof(ip));
      format(string,sizeof(string),"Hand Weapon: %s(%d) | IP: %s | Ping: %d | Skin: %d",handweapname,GetPlayerAmmo(giveplayer),ip,ping,skin);
			SendClientMessage(playerid,COLOR_WHITE,string);
			if (IsPlayerInAnyVehicle(giveplayer)) format(string,sizeof(string),"Vehicle: %s | Vehicle Health: %.0f | State: %s | Faction: %s(%d) | Faction Rank: %d | Flag: %s",GetVehicleName(GetPlayerVehicleID(giveplayer)),vhp,pstate,FactionInfo[PlayerInfo[giveplayer][pFaction]][fName],PlayerInfo[giveplayer][pFaction], PlayerInfo[giveplayer][pFRank],flag);
			else format(string,sizeof(string),"Vehicle: X | Vehicle Health: X | State: %s | Faction: %s(%d) | Faction Rank: %d | Flag: %s | Gender: %s",pstate,FactionInfo[PlayerInfo[giveplayer][pFaction]][fName],PlayerInfo[giveplayer][pFaction], PlayerInfo[giveplayer][pFRank],flag,gender);
			SendClientMessage(playerid,COLOR_WHITE,string);
			GetPlayerWeaponData(giveplayer,1,weapons[0],bullets[0]);
			GetPlayerWeaponData(giveplayer,2,weapons[1],bullets[1]);
			GetPlayerWeaponData(giveplayer,3,weapons[2],bullets[2]);
			GetPlayerWeaponData(giveplayer,4,weapons[3],bullets[3]);
			GetPlayerWeaponData(giveplayer,5,weapons[4],bullets[4]);
			GetPlayerWeaponData(giveplayer,6,weapons[5],bullets[5]);
			GetPlayerWeaponData(giveplayer,7,weapons[6],bullets[6]);
			GetPlayerWeaponData(giveplayer,8,weapons[7],bullets[7]);
			GetPlayerWeaponData(giveplayer,9,weapons[8],bullets[8]);
			GetPlayerWeaponData(giveplayer,10,weapons[9],bullets[9]);
			GetPlayerWeaponData(giveplayer,11,weapons[10],bullets[10]);
			GetPlayerWeaponData(giveplayer,12,weapons[11],bullets[11]);
			GetWeaponName(weapons[0],weapname[0],50);
			GetWeaponName(weapons[1],weapname[1],50);
			GetWeaponName(weapons[2],weapname[2],50);
			GetWeaponName(weapons[3],weapname[3],50);
			GetWeaponName(weapons[4],weapname[4],50);
			GetWeaponName(weapons[5],weapname[5],50);
			GetWeaponName(weapons[6],weapname[6],50);
			GetWeaponName(weapons[7],weapname[7],50);
			GetWeaponName(weapons[8],weapname[8],50);
			GetWeaponName(weapons[9],weapname[9],50);
			GetWeaponName(weapons[10],weapname[10],50);
			GetWeaponName(weapons[11],weapname[11],50);
			for(new b = 0; b < 12; b++) if (bullets[b] == 65535) bullets[b] = 0;
			SendClientMessage(playerid,	COLOR_RED,"--?Weapons");
			format(string,sizeof(string),"%s(0) - %s(%d) - %s(%d) - %s(%d) - %s(%d) - %s(%d)",weapname[0],weapname[1],bullets[1],weapname[2],bullets[2],weapname[3],bullets[3],weapname[4],bullets[4],weapname[5],bullets[5]);
			SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
			format(string,sizeof(string),"%s(%d) - %s(%d) - %s(%d) - %s(0) - %s(0) - %s(0)",weapname[6],bullets[6],weapname[7],bullets[7],weapname[8],bullets[8],weapname[9],weapname[10],weapname[11]);
			SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
			SendClientMessage(playerid,	COLOR_RED,"--?Items");
			new itemcount;
			for(new i = 0; i < MAX_ITEMSLOTS; i++)
			{
				if(PlayerItemsInfo[giveplayer][i][piSQLId] != INVALID_SQL_ID)
				{
					itemcount++;
					format(string, sizeof(string), "%s", BaseProductInfo[PlayerItemsInfo[giveplayer][i][piBaseProductId]][bpName]);
					SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
				}
			}
		}
		return 1;
	}
I know how to make that it will Auto-Write the seconds command, with
Quote:

CallRemoteFunction("OnPlayerCommandText", "is", playerid, "/check2");

, But I don't know how to put the same ID in the seconds FS.

Help me please, Thanks.
Reply
#2

I haven't understood what you're trying to do.
Reply
#3

I want to add to my command /check [playerid], that it will auto write the seconds command (from another FS) : /check2 [playerid].
Reply
#4

i dont get this part:
Quote:

But I don't know how to put the same ID in the seconds FS.

Reply
#5

Ok I will try to explane again..
I want to add something to my /check [playerid] CMDS to it will auto write the /check2 [playerid] (another FS).

If I will put the line CallRemoteFunction("OnPlayerCommandText", "is", playerid, "/check2"); Under my command, itwill auto write my seconds CMD but will not put the ID after the CMDS to the seconsd /check on the playerid.

It will be something like this:

----------------Player Stats---------
dfgag agaghfg fhsghaga gadfg adga g
agagadfgha hah ah ah ah ah ah ah aha
USAGE: /check2 [playerid]

Got it? I want to make the same ID on both of the scripts.
Reply
#6

like this?

pawn Код:
new cmdstring[64];

format (cmdstring, sizeof(cmdstring), "/check2 %d", pid);
CallRemoteFunction("OnPlayerCommandText", "is", playerid, cmdstring);
Reply
#7

I guess it is, but when I add this script under my /check CMD, its crashes the server when I trying to type /check.

Код:
	if (strcmp(cmd, "/check", true) == 0)
	{
    new cmdstring[64];
	  if(IsPlayerConnected(playerid))
	  {
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /check [playerid]");
					return 1;
				}
	      giveplayerid = ReturnUser(tmp);
				if(IsPlayerConnected(giveplayerid))
				{
				  if(giveplayerid != INVALID_PLAYER_ID)
				  {
						ShowStats(playerid,giveplayerid);
						format (cmdstring, sizeof(cmdstring), "/check2 %d", giveplayerid);
            CallRemoteFunction("OnPlayerCommandText", "is", playerid, cmdstring);
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Invalid ID.");
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Your not an administrator.");
			}
		}
		return 1;
	}
Any Ideas?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)