SA-MP Forums Archive
Command doesn't work. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Command doesn't work. (/showthread.php?tid=499240)



Command doesn't work. - rakshith122 - 07.03.2014

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.


Re: Command doesn't work. - Sojo12 - 07.03.2014

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!


Re: Command doesn't work. - rakshith122 - 07.03.2014

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.
._.


Re: Command doesn't work. - JeaSon - 07.03.2014

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;
}



Re: Command doesn't work. - Sojo12 - 07.03.2014

Yeh correct!Did in a haste!


Re: Command doesn't work. - rakshith122 - 07.03.2014

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:


Re: Command doesn't work. - SyntaxQ - 07.03.2014

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.


Re: Command doesn't work. - Sojo12 - 07.03.2014

Код:
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!


Re: Command doesn't work. - biker122 - 07.03.2014

Doesn't it work with return 1?


Re: Command doesn't work. - rakshith122 - 07.03.2014

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