Command doesn't work.
#1

I've been trying to make this command with some help from the forums. I wanted it to make this like, Setting the player's radar mark invisible when he executes the command.
pawn Код:
dcmd_gzinvisible(playerid,params[])
{
   #pragma unused params
   if(CanUseGangZ[playerid] == 0)
   {
     SendClientMessage(playerid,COLOR_ERROR,"[ERROR] You must be a Gang-Z Member to use this command.");
     return 1;
   }
   for(new i = 0; i < MAX_PLAYERS; i++)
   {
      if(IsPlayerConnected(i))
      {
        SetPlayerMarkerForPlayer(i, playerid, 0xFFFFFF00);
      }
      SendClientMessage(playerid,COLOR_PURPLE,"[Gang-Z] You are now invisible on Radar.");
      return 1;
   }
   return 1;
}
Could someone tell me what's wrong and why it doesn't work?
Thanks.
Reply
#2

Here:
Код:
dcmd_gzinvisible(playerid,params[])
{
   #pragma unused params
   if(CanUseGangZ[playerid] == 0)
   {
     SendClientMessage(playerid,COLOR_ERROR,"[ERROR] You must be a Gang-Z Member to use this command.");
     return 1;
   }
   for(new i = 0; i < MAX_PLAYERS; i++)
   {
      if(IsPlayerConnected(i))
      {
        SetPlayerMarkerForPlayer(i, playerid, 0xFFFFFF00);
      }
      SendClientMessage(playerid,COLOR_PURPLE,"[Gang-Z] You are now invisible on Radar.");
      return 1;
}
and there is a possibility for it to say unknown when you're having two command processor in your script!
Reply
#3

Quote:
Originally Posted by Sojo12
Посмотреть сообщение
Here:
Код:
dcmd_gzinvisible(playerid,params[])
{
   #pragma unused params
   if(CanUseGangZ[playerid] == 0)
   {
     SendClientMessage(playerid,COLOR_ERROR,"[ERROR] You must be a Gang-Z Member to use this command.");
     return 1;
   }
   for(new i = 0; i < MAX_PLAYERS; i++)
   {
      if(IsPlayerConnected(i))
      {
        SetPlayerMarkerForPlayer(i, playerid, 0xFFFFFF00);
      }
      SendClientMessage(playerid,COLOR_PURPLE,"[Gang-Z] You are now invisible on Radar.");
      return 1;
}
Will it even work?
You are already missing a bracket after that return 1. and The command should return a value to avoid warnings. Correct me if i'm wrong.
._.
Reply
#4

its fixed now
yeh he was missing a bracket

pawn Код:
dcmd_gzinvisible(playerid,params[])
{
   #pragma unused params
   if(CanUseGangZ[playerid] == 0)
   {
     SendClientMessage(playerid,COLOR_ERROR,"[ERROR] You must be a Gang-Z Member to use this command.");
     return 1;
   }
   for(new i = 0; i < MAX_PLAYERS; i++)
   {
      if(IsPlayerConnected(i))
      {
        SetPlayerMarkerForPlayer(i, playerid, 0xFFFFFF00);
      }
      SendClientMessage(playerid,COLOR_PURPLE,"[Gang-Z] You are now invisible on Radar.");
      }
      return 1;
}
Reply
#5

Yeh correct!Did in a haste!
Reply
#6

Nope,
You did the same mistake as I did lol
After this line >>-->>
pawn Код:
SendClientMessage(playerid,COLOR_PURPLE,"[Gang-Z] You are now invisible on Radar.");
I believe there should be a return 1 or return 0;. Since, I made the same thing as you did, and it spammed my whole screen with "[Gang-Z] You are now invisible on radar"
Still, Not solved yet D:
Reply
#7

pawn Код:
dcmd_gzinvisible(playerid,params[])
{
   #pragma unused params
   if(CanUseGangZ[playerid] == 0)
   {
     SendClientMessage(playerid,COLOR_ERROR,"[ERROR] You must be a Gang-Z Member to use this command.");
     return 1;
   }
   for(new i = 0; i < MAX_PLAYERS; i++)
   {
      if(IsPlayerConnected(i))
      {
        SetPlayerMarkerForPlayer(i, playerid, 0xFFFFFF00);
        SendClientMessage(playerid,COLOR_PURPLE,"[Gang-Z] You are now invisible on Radar.");
      }
   }
   return 1;
}
Try this.
Reply
#8

Код:
dcmd_gzinvisible(playerid,params[])
{
   #pragma unused params
   if(CanUseGangZ[playerid] == 0)
   {
     SendClientMessage(playerid,COLOR_ERROR,"[ERROR] You must be a Gang-Z Member to use this command.");
     return 0;
   }
   for(new i = 0; i < MAX_PLAYERS; i++)
   {
      if(IsPlayerConnected(i))
      {
        SetPlayerMarkerForPlayer(i, playerid, 0xFFFFFF00);
      }
      SendClientMessage(playerid,COLOR_PURPLE,"[Gang-Z] You are now invisible on Radar.");
      }
      return 1;
}
In this line:
Код:
SendClientMessage(playerid,COLOR_ERROR,"[ERROR] You must be a Gang-Z Member to use this command.");
     return 1;
It should return with 0.
Not tested yet!
Reply
#9

Doesn't it work with return 1?
Reply
#10

It got compiled. I'll be testing it if someone joins the server..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)