Teleport Command
#1

pawn Код:
CMD:tune(playerid,params[])
{
    {
        if(isnull(params))
        {
            SendClientMessage(playerid, red, " Usage: /tune [1-4] ");
            SendClientMessage(playerid, red, " FUNCTION: To Teleport To The Tune Garages ");
            return 1;
        }
        if(strcmp(params,"1",true) == 0)
        {
                if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) //They are driving a vehicle
            {
                SetVehiclePos(GetPlayerVehicleID(playerid), -1935.985, 231.728, 34.1546);
            }
                else //They are on-foot or a passenger
            {
                SetPlayerPos(playerid, -1935.985, 231.728, 34.1546);
                new msg[999];
                new dsname[MAX_PLAYER_NAME];
                new string[999];
                format(string, sizeof(string), "%s has just teleported to Tune 1 /Tune 1", dsname);
                SendClientMessageToAll(COLOR_YELLOW, string);

                format(string, sizeof(string), "~B~Welcome To ~r~Tune 1");
                GameTextForPlayer(playerid, string, 3000, 4);
            }
        }
        else if(strcmp(params,"2",true) == 0)
        {
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) //They are driving a vehicle
            {
                SetVehiclePos(GetPlayerVehicleID(playerid), -2709.731, 217.423, 4.179);
            }
                else //They are on-foot or a passenger
            {
                SetPlayerPos(playerid, -2709.731, 217.423, 4.179);
                new msg[128];
                new dsname[MAX_PLAYER_NAME];
                new string[128];
                format(string, sizeof(string), "%us has just teleported to Tune 2 /Tune 2", dsname);
                SendClientMessageToAll(yellow, msg);

                format(string, sizeof(string), "~B~Welcome To ~r~Tune 2");
                GameTextForPlayer(playerid, string, 3000, 4);
            }
        }
        else if(strcmp(params,"3",true) == 0)
        {
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) //They are driving a vehicle
            {
                SetVehiclePos(GetPlayerVehicleID(playerid), 2386.802, 1036.320, 10.280);
            }
                else //They are on-foot or a passenger
            {
                SetPlayerPos(playerid, 2386.802, 1036.320, 10.280);
                new msg[128];
                new dsname[MAX_PLAYER_NAME];
                new string[128];
                format(string, sizeof(string), "%us has just teleported to Tune 3 /Tune 3", dsname);
                SendClientMessageToAll(yellow, msg);

                format(string, sizeof(string), "~B~Welcome To ~r~Tune 3");
                GameTextForPlayer(playerid, string, 3000, 4);
            }
        }
        else if(strcmp(params,"4",true) == 0)
        {
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) //They are driving a vehicle
            {
                 SetVehiclePos(GetPlayerVehicleID(playerid), 2644.976, -2030.903, 13.554);
            }
                else //They are on-foot or a passenger
            {
                SetPlayerPos(playerid, 2644.976, -2030.903, 13.554);
                new msg[128];
                new dsname[MAX_PLAYER_NAME];
                new string[128];
                format(string, sizeof(string), "%us has just teleported to Tune 4 /Tune 4", dsname);
                SendClientMessageToAll(yellow, msg);

                format(string, sizeof(string), "~B~Welcome To ~r~Tune 4");
                GameTextForPlayer(playerid, string, 3000, 4);
            }
        }
    }
    return 1;
}
please Help me
BUGS
The SendCleintMessageToAll Is Not Working
Example:
/tune 1
And i Teleport But The Message Dosent Work Need help
Reply
#2

Try this version that I made:

pawn Код:
CMD:tune(playerid, params[])
{
    if(isnull(params))
    {
        SendClientMessage(playerid, COLOR_GREY, "[USAGE]: /tune [1-4]");
    }
    if(strval(params) == 1)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        new State = GetPlayerState(playerid);
        new string[128];
        if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)
        {
            format(string, sizeof(string), "%s [ID:%d] has gone to Tuning 1 (/tune 1)", GetName(playerid), playerid);
            SendClientMessageToAll(COLOR_YELLOW, string);
            GameTextForPlayer(playerid, "~w~ Welcome To Tuning 1! ~G~", 5000, 5);
            return SetVehiclePos(vehicleid, -1935.9851, 231.7287, 34.1563);
        }
        format(string, sizeof(string), "%s [ID:%d] has gone to Tuning 1 (/tune 1)", GetName(playerid), playerid);
        SendClientMessageToAll(COLOR_YELLOW, string);
        GameTextForPlayer(playerid, "~w~ Welcome To Tuning 1! ~G~", 5000, 5);
        SetPlayerPos(playerid, -1935.9851, 231.7287, 34.1563);
    }
    if(strval(params) == 2)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        new State = GetPlayerState(playerid);
        new string[128];
        if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)
        {
            format(string, sizeof(string), "%s [ID:%d] has gone to Tuning 2 (/tune 2)", GetName(playerid), playerid);
            SendClientMessageToAll(COLOR_YELLOW, string);
            GameTextForPlayer(playerid, "~w~ Welcome to Tuning 2! ~G~", 5000, 5);
            return SetVehiclePos(vehicleid, -2709.7312, 217.4238, 4.1797);
        }
        format(string, sizeof(string), "%s [ID:%d] has gone to Tuning 2 (/tune 2)", GetName(playerid), playerid);
        SendClientMessageToAll(COLOR_YELLOW, string);
        GameTextForPlayer(playerid, "~w~ Welcome to Tuning 2! ~G~", 5000, 5);
        SetPlayerPos(playerid, -2709.7312, 217.4238, 4.1797);
    }
    if(strval(params) == 3)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        new State = GetPlayerState(playerid);
        new string[128];
        if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)
        {
            format(string, sizeof(string), "%s [ID:%d] has gone To Tuning 3 (/tune 3)", GetName(playerid), playerid);
            SendClientMessageToAll(COLOR_YELLOW, string);
            GameTextForPlayer(playerid, "~w~ Welcome To Tuning 3! ~G~", 5000, 5);
            return SetVehiclePos(vehicleid, 2386.8020, 1036.3203, 10.8203);
        }
        format(string, sizeof(string), "%s [ID:%d] has gone to Tuning 3 (/tune 3)", GetName(playerid), playerid);
        SendClientMessageToAll(COLOR_YELLOW, string);
        GameTextForPlayer(playerid, "~w~ Welcome To Tuning 3! ~G~", 5000, 5);
        SetPlayerPos(playerid, 2386.8020, 1036.3203, 10.8203);
    }
    if(strval(params) == 4)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        new State = GetPlayerState(playerid);
        new string[128];
        if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)
        {
            format(string, sizeof(string), "%s [ID:%d] has gone to Tuning 4 (/tune 4)", GetName(playerid), playerid);
            SendClientMessageToAll(COLOR_YELLOW, string);
            GameTextForPlayer(playerid, "~w~  Welcome To Tuning 4! ~G~", 5000, 5);
            return SetVehiclePos(vehicleid, 2644.9768, -2030.9032, 13.5540);
        }
        format(string, sizeof(string), "%s [ID:%d] has gone to Tuning 4 (/tune 4)", GetName(playerid), playerid);
        SendClientMessageToAll(COLOR_YELLOW, string);
        GameTextForPlayer(playerid, "~w~  Welcome To Tuning 4! ~G~", 5000, 5);
        SetPlayerPos(playerid, 2644.9768, -2030.9032, 13.5540);

    }
    return 1;
}
Also you will need this stock:

pawn Код:
stock GetName(playerid)
{
    new Name[MAX_PLAYER_NAME];
    if(IsPlayerConnected(playerid))
    {
        GetPlayerName(playerid, Name, sizeof(Name));
    }
    return Name;
}
Try that and tell me if it works.
Reply
#3

i made one here it is:

pawn Код:
CMD:tune(playerid, params[])
{
    if(isnull(params))
    {
        SendClientMessage(playerid, red, " Usage: /tune [1-4] ");
        SendClientMessage(playerid, red, " FUNCTION: To Teleport To The Tune Garages ");
        return 1;
    }
    else
    {
        switch(strval(params))
        {
            case 1:
            {
                if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                {
                    SetVehiclePos(GetPlayerVehicleID(playerid), -1935.985, 231.728, 34.1546);
                }
                else
                {
                    SetPlayerPos(playerid, -1935.985, 231.728, 34.1546);
                }
               
                new msg[999];
                new dsname[MAX_PLAYER_NAME];
                new string[100];
                format(string, sizeof(string), "%s has just teleported to Tune 1 /Tune 1", dsname);
                SendClientMessageToAll(COLOR_YELLOW, string);

                GameTextForPlayer(playerid, "~B~Welcome To ~r~Tune 1", 3000, 4);
                return 1;
            }
            case 2:
            {
                if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                {
                    SetVehiclePos(GetPlayerVehicleID(playerid), -2709.731, 217.423, 4.179);
                }
                else
                {
                    SetPlayerPos(playerid, -2709.731, 217.423, 4.179);
                }

                new msg[999];
                new dsname[MAX_PLAYER_NAME];
                new string[100];
                format(string, sizeof(string), "%s has just teleported to Tune 2 /Tune 2", dsname);
                SendClientMessageToAll(COLOR_YELLOW, string);

                GameTextForPlayer(playerid, "~B~Welcome To ~r~Tune 2", 3000, 4);
                return 1;
            }
            case 3:
            {
                if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                {
                    SetVehiclePos(GetPlayerVehicleID(playerid), 2386.802, 1036.320, 10.280);
                }
                else
                {
                    SetPlayerPos(playerid, 2386.802, 1036.320, 10.280);
                }

                new msg[999];
                new dsname[MAX_PLAYER_NAME];
                new string[100];
                format(string, sizeof(string), "%s has just teleported to Tune 1 /Tune 3", dsname);
                SendClientMessageToAll(COLOR_YELLOW, string);

                GameTextForPlayer(playerid, "~B~Welcome To ~r~Tune 3", 3000, 4);
                return 1;
            }
            case 4:
            {
                if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                {
                    SetVehiclePos(GetPlayerVehicleID(playerid), 2644.976, -2030.903, 13.554);
                }
                else
                {
                    SetPlayerPos(playerid, 2644.976, -2030.903, 13.554);
                }

                new msg[999];
                new dsname[MAX_PLAYER_NAME];
                new string[100];
                format(string, sizeof(string), "%s has just teleported to Tune 1 /Tune 4", dsname);
                SendClientMessageToAll(COLOR_YELLOW, string);

                GameTextForPlayer(playerid, "~B~Welcome To ~r~Tune 4", 3000, 4);
                return 1;
            }
        }
    }
    return 1;
}
Reply
#4

C:\Users\iliyan\Desktop\Alfa-game Real life v0.5\gamemodes\justplay.pwn(233) : error 017: undefined symbol "red"
C:\Users\iliyan\Desktop\Alfa-game Real life v0.5\gamemodes\justplay.pwn(234) : error 017: undefined symbol "red"
C:\Users\iliyan\Desktop\Alfa-game Real life v0.5\gamemodes\justplay.pwn(250) : error 017: undefined symbol "COLOR_YELLOW"
C:\Users\iliyan\Desktop\Alfa-game Real life v0.5\gamemodes\justplay.pwn(246) : warning 204: symbol is assigned a value that is never used: "msg"
C:\Users\iliyan\Desktop\Alfa-game Real life v0.5\gamemodes\justplay.pwn(269) : error 017: undefined symbol "yellow"
C:\Users\iliyan\Desktop\Alfa-game Real life v0.5\gamemodes\justplay.pwn(28 : error 017: undefined symbol "yellow"
C:\Users\iliyan\Desktop\Alfa-game Real life v0.5\gamemodes\justplay.pwn(307) : error 017: undefined symbol "yellow"
Pawn compiler 3.2.3664 Copyright (coffee) 1997-2006, ITB CompuPhase


6 Errors.
how to fix them ?
Reply
#5

#define COLOR_RED idofcolor
#define COLOR_YELLOW idofcolor


^ on top of your script, ****** the color ids..


and find the " new msg" and remove it.
Reply
#6

Quote:
Originally Posted by Neonman
Посмотреть сообщение
#define COLOR_RED idofcolor
#define COLOR_YELLOW idofcolor


^ on top of your script, ****** the color ids..


and find the " new msg" and remove it.
C:\Users\iliyan\Desktop\Alfa-game Real life v0.5\gamemodes\justplay.pwn(234) : error 017: undefined symbol "red"
C:\Users\iliyan\Desktop\Alfa-game Real life v0.5\gamemodes\justplay.pwn(235) : error 017: undefined symbol "red"
C:\Users\iliyan\Desktop\Alfa-game Real life v0.5\gamemodes\justplay.pwn(257) : error 017: undefined symbol "idofcolor"
C:\Users\iliyan\Desktop\Alfa-game Real life v0.5\gamemodes\justplay.pwn(276) : error 017: undefined symbol "idofcolor"
C:\Users\iliyan\Desktop\Alfa-game Real life v0.5\gamemodes\justplay.pwn(295) : error 017: undefined symbol "idofcolor"
C:\Users\iliyan\Desktop\Alfa-game Real life v0.5\gamemodes\justplay.pwn(314) : error 017: undefined symbol "idofcolor"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


6 Errors.
look like this ?//--Gamemode Name--//
#define GameModeName "Alfa-Game.Info .::[ RealLife ]::.[0.3x]"

#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
then i get this .. C:\Users\iliyan\Desktop\Alfa-game Real life v0.5\gamemodes\justplay.pwn(236) : error 017: undefined symbol "red"
C:\Users\iliyan\Desktop\Alfa-game Real life v0.5\gamemodes\justplay.pwn(237) : error 017: undefined symbol "red"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#7

do
not with big word coz you used red not RED
pawn Код:
#define red 0xAA3333AA
Reply
#8

Quote:
Originally Posted by Xoomer
Посмотреть сообщение
do
not with big word coz you used red not RED
pawn Код:
#define red 0xAA3333AA
it dont show who teleported to the tune it just says has just teleported to tune 2 ? doesn't say the name help ;d
Reply
#9

Untested:
pawn Код:
CMD:tune(playerid, params[])
{
    if(isnull(params))
    {
        SendClientMessage(playerid, red, " Usage: /tune [1-4] ");
        SendClientMessage(playerid, red, " FUNCTION: To Teleport To The Tune Garages ");
        return 1;
    }
    else
    {
        new dsname[MAX_PLAYER_NAME];
        GetPlayerName(playerid,dsname,sizeof(dsname));
        switch(strval(params))
        {
            case 1:
            {
                if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                {
                    SetVehiclePos(GetPlayerVehicleID(playerid), -1935.985, 231.728, 34.1546);
                }
                else
                {
                    SetPlayerPos(playerid, -1935.985, 231.728, 34.1546);
                }
               
                new msg[999];
                new string[100];
                format(string, sizeof(string), "%s has just teleported to Tune 1 (/Tune 1)", dsname);
                SendClientMessageToAll(COLOR_YELLOW, string);

                GameTextForPlayer(playerid, "~B~Welcome To ~r~Tune 1", 3000, 4);
                return 1;
            }
            case 2:
            {
                if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                {
                    SetVehiclePos(GetPlayerVehicleID(playerid), -2709.731, 217.423, 4.179);
                }
                else
                {
                    SetPlayerPos(playerid, -2709.731, 217.423, 4.179);
                }

                new msg[999];
                new string[100];
                format(string, sizeof(string), "%s has just teleported to Tune 2 (/Tune 2)", dsname);
                SendClientMessageToAll(COLOR_YELLOW, string);

                GameTextForPlayer(playerid, "~B~Welcome To ~r~Tune 2", 3000, 4);
                return 1;
            }
            case 3:
            {
                if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                {
                    SetVehiclePos(GetPlayerVehicleID(playerid), 2386.802, 1036.320, 10.280);
                }
                else
                {
                    SetPlayerPos(playerid, 2386.802, 1036.320, 10.280);
                }

                new msg[999];
                new string[100];
                format(string, sizeof(string), "%s has just teleported to Tune 3 (/Tune 3)", dsname);
                SendClientMessageToAll(COLOR_YELLOW, string);

                GameTextForPlayer(playerid, "~B~Welcome To ~r~Tune 3", 3000, 4);
                return 1;
            }
            case 4:
            {
                if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                {
                    SetVehiclePos(GetPlayerVehicleID(playerid), 2644.976, -2030.903, 13.554);
                }
                else
                {
                    SetPlayerPos(playerid, 2644.976, -2030.903, 13.554);
                }

                new msg[999];
                new string[100];
                format(string, sizeof(string), "%s has just teleported to Tune 4 (/Tune 4)", dsname);
                SendClientMessageToAll(COLOR_YELLOW, string);

                GameTextForPlayer(playerid, "~B~Welcome To ~r~Tune 4", 3000, 4);
                return 1;
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)