bugged /pm command
#1

well this /pm command is somehow bugged

Код:
	if(strcmp(cmd, "/pm", true) == 0)
 	{
  		if(IsPlayerConnected(playerid))
    	{
     		if(PlayerInfo[playerid][pAdmin] == 0 || PlayerInfo[playerid][pGameMaster] >= 1)
	         {
	             SendClientMessage(playerid, COLOR_WHITE, "   Ne ste Ovlasteni za Ovaa Komanda!.");
	             return 1;
	         }
     		if(gPlayerLogged[playerid] == 0)
	           	{
	               SendClientMessage(playerid, COLOR_WHITE, "   Ne Ste Logirani!");
	               return 1;
	           	}
	         tmp = strtok(cmdtext, idx);
	         if(!strlen(tmp))
	         {
	            SendClientMessage(playerid, COLOR_WHITE, "KORISTI: /pm [ID/Ime Na Igrac] [text]");
	            return 1;
	         }
	         giveplayerid = ReturnUser(tmp);
          		if(PlayerInfo[playerid][pAdmin] == 1 || PlayerInfo[playerid][pGameMaster] >= 1)
	          	{
         	if (IsPlayerConnected(giveplayerid))
         		{
          	if(giveplayerid != INVALID_PLAYER_ID)
          	 {
	                 if(HidePM[giveplayerid] > 0)
	                 {
	                     SendClientMessage(playerid, COLOR_GREY, " ");
	                     return 1;
	                 }
   				   GetPlayerName(playerid, sendername, sizeof(sendername));
	               GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
	               new length = strlen(cmdtext);
	               while ((idx < length) && (cmdtext[idx] <= ' '))
	               {
	                  idx++;
	               }
	               new offset = idx;
	               new result[64];
	               while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
	               {
	                  result[idx - offset] = cmdtext[idx];
	                  idx++;
	               }
	               result[idx - offset] = EOS;
	               if(!strlen(result))
	               {
	                  SendClientMessage(playerid, COLOR_WHITE, "KORISTI: /pm [ID/Ime Na Igrac] [text]");
	                  return 1;
	               }
	               format(string, sizeof(string), "[ID:%d] %s pm you: %s", playerid, sendername, (result));
	               SendClientMessage(giveplayerid, COLOR_LIGHTRED, string);
	               format(string, sizeof(string), "Pm Sent [ID:%d]%s: %s", giveplayerid, giveplayer, (result));
	               SendClientMessage(playerid,  COLOR_LIGHTRED, string);
	               return 1;
	            }
	         }
	         else
	         {
	               format(string, sizeof(string), "   %d Ne e Aktiven Igrac !.", giveplayerid);
	               SendClientMessage(playerid, COLOR_GRAD1, string);
	         }
	         }
     	}
     	return 1;
  	}
Because When i type /pm it show this message
Quote:

"KORISTI: /pm [ID/Ime Na Igrac] [text]"

But when this line of the code is
Код:
if(PlayerInfo[playerid][pAdmin] == 0 || PlayerInfo[playerid][pGameMaster] >= 1)
But when i type fo example /pm 3 hi it doesn't do anything
how can i fix that problem so that it sends a pm also from rank 1 to 1338 admin and gamemasters also only no players to be able to send PM
Reply
#2

i would prefer a selfmade one, this looks a lot like the standard one, if you are interested, you can get mine?
Reply
#3

pawn Код:
if(strcmp("/mp", cmd, true) == 0)
    {
   
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, CINZENTO, "USO: /mp [Player-Id] [MENSAGEM]");
    otherid = ReturnUser(tmp);
    if(!IsPlayerConnected(otherid)) return SendClientMessage(playerid, CINZENTO, "Player Desconectado");
    new message[128];
    message = strrest(cmdtext, idx);
    if(!strlen(message)) return SendClientMessage(playerid, CINZENTO, "USO: /mp [Player-Id] [MENSAGEM]");
    if(strlen(message) > 55) return SendClientMessage(playerid, CINZENTO, "Mensagem Demasiado Grande");
    if(otherid == playerid) return SendClientMessage(playerid, CINZENTO, "Vocк nгo pode enviar uma mensagem a si prуprio");
    if(GetPlayerMoney(playerid) < 20) return SendClientMessage(playerid, CINZENTO, "Sem Dinheiro Suficiente ($20)");
    format(string, sizeof(string), "Mensagem de: %s: %s", PlayerName(playerid), message);
    SendClientMessage(otherid, AMARELO, string);
    format(string, sizeof(string), "Enviado a %s: %s", PlayerName(otherid), message);
    SendClientMessage(playerid, AMARELO, string);
    GivePlayerMoney(playerid, -20);
    return 1;
    }

Strrest:
https://sampwiki.blast.hk/wiki/Functiontrrest


Try to compair...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)