Command help - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Command help (
/showthread.php?tid=122185)
Command help -
Jo1Nt - 20.01.2010
I would like to do a command /dmv = it teleportes the player to the dmv test
Код:
if(!strcmp(cmdtext,"/dmv",true))
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pModerator] >= 1)
{
SetPlayerPos(playerid,1742.2769,-1861.6323,13.5773);
return 1;
}
return 0;
}
Is correct?
Re: Command help -
MadeMan - 20.01.2010
You don't need IsPlayerConnected check and you have a closing bracket missing.
pawn Код:
if(!strcmp(cmdtext,"/dmv",true))
{
if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pModerator] >= 1)
{
SetPlayerPos(playerid,1742.2769,-1861.6323,13.5773);
return 1;
}
}
Re: Command help -
Jo1Nt - 20.01.2010
But it teleports just me .i can't teleport someone .Can you help me with this?
Re: Command help -
MadeMan - 20.01.2010
https://sampwiki.blast.hk/wiki/Fast_Commands
Re: Command help -
Jo1Nt - 20.01.2010
I looked over it so:
Код:
if (strlen(tmp))
{
id = strval(tmp);
if (IsPlayerConnected(id))
{
Is that correct?
Re: Command help -
MadeMan - 20.01.2010
You need everything there, but change the SetPlayerHealth to SetPlayerPos as you had before.
Re: Command help -
Jo1Nt - 20.01.2010
Код:
D:\Fane\GaMeGatE [0.3a]\gamemodes\FunBase.pwn(18101) : error 029: invalid expression, assumed zero
D:\Fane\GaMeGatE [0.3a]\gamemodes\FunBase.pwn(18101) : error 029: invalid expression, assumed zero
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new
index,
cmd[20];
cmd = strtok(cmdtext, index);
if (strcmp(cmd, "/dmv", true) == 0)
{
new
tmp[20],
id;
tmp = strtok(cmdtext, index);
if (strlen(tmp))
{
id = strval(tmp);
if (IsPlayerConnected(id))
{
SetPlayerPos(playerid,1742.2769,-1861.6323,13.5773);
SendClientMessage(id, 0x00FF00AA, "Ai fost teleportat de catre un admin la DMV");
SendClientMessage(playerid, 0x00FF00AA, "Player TP-ed");
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Player not found");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/dmv <playerid>\"");
}
return 1;
}
return 0;
}
Re: Command help -
Jo1Nt - 20.01.2010
I solved it.The solution
Код:
if (strcmp(cmd, "/dmv", true) == 0)
{
new
index,
cmd[20];
cmd = strtok(cmdtext, index);
{
new
tmp[20],
id;
tmp = strtok(cmdtext, index);
if (strlen(tmp))
{
id = strval(tmp);
if (IsPlayerConnected(id))
{
SetPlayerPos(playerid,1742.2769,-1861.6323,13.5773);
SendClientMessage(id, 0x00FF00AA, "Ai fost teleportat de catre un admin la DMV");
SendClientMessage(playerid, 0x00FF00AA, "Player TP-ed");
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Player not found");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/dmv <playerid>\"");
}
return 1;
}
return 0;
}