[HELP] /taze - How can I configure it so it tazes the player's ID and not mine
#1

if(strcmp(cmdtext, "/taze", true) == 0)
{
if (IsPlayerConnected(playerid))

TogglePlayerControllable(playerid,0);
return 1;
}
return 0;
}
Reply
#2

So wait.. You just want a command that does TogglePlayerControllable to who you select? Example: /taze [ID]?

If so... Below I've scripted basically what I think you're trying to do, but using DCMD and SSCANF.

Код:
dcmd_taze(playerid, params[])
{
	new
		ID;
	if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR, "SYNTAX: /taze [PlayerID/PartOfName]");
	if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR, "Invalid Player ID");
	else
	{
		TogglePlayerControllable(ID, false);
	}
	return 1;
}
It's untested, but it's a fairly simple command, so it should work.
Reply
#3

pawn Код:
public OnPlayerCommmandText(playerid, cmdtext[])
{
  new
    cmd[128],
    idx;

  cmd = strtok(cmdtext, idx);
  if(strcmp(cmd, "taze", true) == 0)
  {
    new
      tmp[128];

    tmp = strtok(cmdtext, idx);
    if(strlen(tmp) < 1) return SendClientMessage(playerid, COLOR, "USAGE: /taze [playerid]");
    else
    {
      new
        id = strval(tmp);

      if(IsPlayerConnected(id))
      {
        TogglePlayerControllable(playerid, 0);
      }
      else SendClientMessage(playerid, COLOR, "That player is not conected to the server!");
    }
    return 1;
  }
  return 0;
}
https://sampwiki.blast.hk/wiki/Fast_Commands (better than what I posted!)
Reply
#4

DCMD is better... psshh..
Reply
#5

use sscanf+zcmd its the best
Reply
#6

Quote:
Originally Posted by Lajko1
use sscanf+zcmd its the best
This. Much easier to work with. With zcmd it would look like:
pawn Код:
zcmd(taze,playerid,params[])
{
   if(!sscanf(params,"u",ID)
   {
      TogglePlayerControllable(ID,false);
      return 1;
   }
   else return SendClientMessage(playerid,/*insert colour here*/,"USAGE: /taze [id/name]");
}
UNTESTED
Reply
#7

Quote:
Originally Posted by biltong
Quote:
Originally Posted by Lajko1
use sscanf+zcmd its the best
This. Much easier to work with. With zcmd it would look like:
pawn Код:
zcmd(taze,playerid,params[])
{
   if(!sscanf(params,"u",ID)
   {
      TogglePlayerControllable(ID,false);
      return 1;
   }
   else return SendClientMessage(playerid,/*insert colour here*/,"USAGE: /taze [id/name]");
}
UNTESTED
it will not work cuz u forget ''new ID;''
Reply
#8

sry for dubble post but try this

Код:
zcmd(taze,playerid,params[])
{
   new
      ID;

   if(!sscanf(params,"u",ID)
   {
      TogglePlayerControllable(ID,false);
      return 1;
   }
   else return SendClientMessage(playerid,/*insert colour here*/,"USAGE: /taze [id/name]");
}
Reply
#9

Quote:
Originally Posted by Lajko1
sry for dubble post but try this

Код:
zcmd(taze,playerid,params[])
{
  new
     ID;

  if(!sscanf(params,"u",ID)
  {
     TogglePlayerControllable(ID,false);
     return 1;
  }
  else return SendClientMessage(playerid,/*insert colour here*/,"USAGE: /taze [id/name]");
}
Why didn't you just modify your old post? -.-
Reply
#10

nah idk but i think this doesnt matter right ? man just need the code
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)