Command help
#1

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?
Reply
#2

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;
        }
    }
Reply
#3

But it teleports just me .i can't teleport someone .Can you help me with this?
Reply
#4

https://sampwiki.blast.hk/wiki/Fast_Commands
Reply
#5

I looked over it so:
Код:
		if (strlen(tmp))
		{
			id = strval(tmp);
			if (IsPlayerConnected(id))
			{
Is that correct?
Reply
#6

You need everything there, but change the SetPlayerHealth to SetPlayerPos as you had before.
Reply
#7

Код:
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;
}
Reply
#8

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


Forum Jump:


Users browsing this thread: 1 Guest(s)