[HELP] /taze - How can I configure it so it tazes the player's ID and not mine -
Blokk - 13.03.2010
if(strcmp(cmdtext, "/taze", true) == 0)
{
if (IsPlayerConnected(playerid))
TogglePlayerControllable(playerid,0);
return 1;
}
return 0;
}
Re: [HELP] /taze - How can I configure it so it tazes the player's ID and not mine -
Lejo - 13.03.2010
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.
Re: [HELP] /taze - How can I configure it so it tazes the player's ID and not mine -
Miguel - 13.03.2010
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!)
Re: [HELP] /taze - How can I configure it so it tazes the player's ID and not mine -
Lejo - 13.03.2010
DCMD is better... psshh..
Re: [HELP] /taze - How can I configure it so it tazes the player's ID and not mine -
Lajko1 - 13.03.2010
use sscanf+zcmd its the best
Re: [HELP] /taze - How can I configure it so it tazes the player's ID and not mine -
biltong - 13.03.2010
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
Re: [HELP] /taze - How can I configure it so it tazes the player's ID and not mine -
Lajko1 - 13.03.2010
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;''
Re: [HELP] /taze - How can I configure it so it tazes the player's ID and not mine -
Lajko1 - 13.03.2010
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]");
}
Re: [HELP] /taze - How can I configure it so it tazes the player's ID and not mine -
Lejo - 13.03.2010
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? -.-
Re: [HELP] /taze - How can I configure it so it tazes the player's ID and not mine -
Lajko1 - 13.03.2010
nah idk but i think this doesnt matter right ? man just need the code