[SOLVED] PlayerInfo
#1

Hello Scripters

Alright, I am trying to put

Код:
PlayerInfo
to my Police Radio Script...

Код:
  if (strcmp("/ra", cmdtext, true, 3) == 0)
	{
	  if (PlayerInfo[playerid][Rank] >= 1)
		if(GetPlayerTeam(playerid) != 8) return SendClientMessage(playerid,0xFF0000FF, "Identification Error - You are not a Police Officer with the correct Rank.");
    	if(cmdtext[3] == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /ra [text]");
    	new playername[26];
    	GetPlayerName(playerid, playername, 26);
    	format(string, sizeof(string), "Radio Call from Officer %s:%s, over**", playername, cmdtext[3]);
    	for(new i=0;i<MAX_PLAYERS;i++)
    	{ if(GetPlayerTeam(playerid) == 8) { SendClientMessage(i, 0x0000FFFF, string); } }
    	return 1;
	}
I want to connect the cmd to a Rank... like this...

Код:
if (PlayerInfo[playerid][Rank] >= 1)
But "0" Ranked can still use the cmd...

What to do? Thanks!
Reply
#2

Sorry for Double post, but I dont want this to be forgotten
Reply
#3

pawn Код:
if (strcmp("/ra", cmdtext, true, 3) == 0)
    {
      if (PlayerInfo[playerid][Rank] <= 0) return SendClientMessage(playerid,0xFF0000FF, "Identification Error - You are not a Police Officer with the correct Rank.");
        if(GetPlayerTeam(playerid) != 8) return SendClientMessage(playerid,0xFF0000FF, "Identification Error - You are not a Police Officer with the correct Rank.");
        if(cmdtext[3] == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /ra [text]");
        new playername[26];
        GetPlayerName(playerid, playername, 26);
        format(string, sizeof(string), "Radio Call from Officer %s:%s, over**", playername, cmdtext[3]);
        for(new i=0;i<MAX_PLAYERS;i++)
        { if(GetPlayerTeam(playerid) == 8) { SendClientMessage(i, 0x0000FFFF, string); } }
        return 1;
    }
Reply
#4

1.st 2 hours sience last post then bump

pawn Код:
if (strcmp("/ra", cmdtext, true, 3) == 0)
    {
      if (PlayerInfo[playerid][Rank] < 1) return SendClientMessage(playerid,0xFF0000FF, "Identification Error - You dont have the Rank for this!");
        if(GetPlayerTeam(playerid) != 8) return SendClientMessage(playerid,0xFF0000FF, "Identification Error - You are not a Police Officer!");
        if(cmdtext[3] == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /ra [text]");
        new playername[26];
        GetPlayerName(playerid, playername, 26);
        format(string, sizeof(string), "Radio Call from Officer %s:%s, over**", playername, cmdtext[3]);
        for(new i=0;i<MAX_PLAYERS;i++)
        { if(GetPlayerTeam(i) == 8) { SendClientMessage(i, 0x0000FFFF, string); } }
        return 1;
    }
pawn Код:
if(GetPlayerTeam(playerid) == 8) //IS WRONG! (It will send only if the user self is team 8 and then message will be send to ALL)
if(GetPlayerTeam(i) == 8) //IS RIGHT! (will send to everyone with Team 8)
Reply
#5

Quote:
Originally Posted by Miokie*
pawn Код:
if (strcmp("/ra", cmdtext, true, 3) == 0)
    {
      if (PlayerInfo[playerid][Rank] <= 0) return SendClientMessage(playerid,0xFF0000FF, "Identification Error - You are not a Police Officer with the correct Rank.");
        if(GetPlayerTeam(playerid) != 8) return SendClientMessage(playerid,0xFF0000FF, "Identification Error - You are not a Police Officer with the correct Rank.");
    if(cmdtext[3] == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /ra [text]");
    new playername[26];
    GetPlayerName(playerid, playername, 26);
    format(string, sizeof(string), "Radio Call from Officer %s:%s, over**", playername, cmdtext[3]);
    for(new i=0;i<MAX_PLAYERS;i++)
    { if(GetPlayerTeam(playerid) == 8) { SendClientMessage(i, 0x0000FFFF, string); } }
    return 1;
    }
Thank you for the help, this works perfect
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)