need help with /pgoto and /tele commands.
#6

Have fun!
pawn Код:
new teleon[MAX_PLAYERS]

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/tele", cmdtext, true) == 0)
    {
        if(tele == 0)
        {
            tele = 1;
            SendClientMessage(playerid, -1, "Tele is enabled now");
        }
        else
        {
            tele = 0;
            SendClientMessage(playerid, -1, "Tele is disabled now");
        }
        return 1;
    }
    if (strcmp("/pgoto", cmdtext, true) == 0)
    {
        if(tele == 0)
        {
            SendClientMessage(playerid, -1, "ERROR: Tele is disabled!");
        }
        else
        {
            new tmp[256], player, Float:X, Float:Y, Float:Z, carid, seat;
            tmp = strtok(cmdtext, idx);
            player = strval(tmp);
            GetPlayerPos(player, X, Y, Z);
            if(IsPlayerInAnyVehicle(playerid))
            {
                carid = GetPlayerVehicleID(playerid);
                seat = GetPlayerVehicleSeat(playerid);
                SetVehiclePos(carid, X+1, Y, Z);
                PutPlayerInVehicle(playerid, carid, seat);
                return 1;
            }
            SetPlayerPos(playerid, X+1, Y, Z);
        }
        return 1;
    }
    return 0;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)