[FilterScript] Essentials [17.04.2013]
#2

You should re-factor your teleport commands since all the code is basically the same.

Before

pawn Код:
CMD:vinewood(playerid)
{
        new string[256], pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
        format(string,sizeof string,"%s {FFFFFF}has gone to {33AA33}Vinewood (/vinewood)",pName);
        SendClientMessageToAll(green,string);
        if (IsPlayerInAnyVehicle(playerid))
        {
                SetVehiclePos(GetPlayerVehicleID(playerid), 1413.2775,-871.3857,46.9813);
                LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
        }
        if (!IsPlayerInAnyVehicle(playerid))
        {
                SetPlayerPos(playerid, 1413.2775,-871.3857,46.9813);
                SetPlayerInterior(playerid, 0);
        }
        return 1;
}
After

pawn Код:
CMD:vinewood(playerid) { TeleportPlayer(playerid, "Vinewood", "Vinewood", 1413.2775,-871.3857,46.9813, 0); return 1; }
CMD:lvair(playerid) { TeleportPlayer(playerid, "Las Venturas Airport", "lvair", 1318.8335,1255.4017,10.8203, 0); return 1; }

stock TeleportPlayer(playerid, LocationName[], LocationCommand[], Float:LocX, Float:LocY, Float:LocZ, InteriorID)
{
        new string[128], pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
        format(string,sizeof string,"%s {FFFFFF}has gone to {33AA33}%s(/%s)",pName, LocationName, LocationCommand);
        SendClientMessageToAll(green,string);
        if (IsPlayerInAnyVehicle(playerid))
        {
                SetVehiclePos(GetPlayerVehicleID(playerid), LocX,LocY,LocZ);
                LinkVehicleToInterior(GetPlayerVehicleID(playerid), InteriorID);
        }
        if (!IsPlayerInAnyVehicle(playerid))
        {
                SetVehiclePos(GetPlayerVehicleID(playerid), LocX,LocY,LocZ);
                SetPlayerInterior(playerid, InteriorID);
        }
        return 1;
}
I don't know about you but that will save a lot of lines of code and also make it really easy to add more locations without bloating your script with copy/paste code.

One more thing

SendClientMessage(playerid,green,"ES Message: {FFFFFF}You've setted your time to {33AA33} 12:00!");

There is no such word as "setted" in the English language it would simply be "set".
Reply


Messages In This Thread
Essentials [17.04.2013] - by [Ro]DuReX - 17.04.2013, 04:16
Re: Essentials [17.04.2013] - by Pottus - 17.04.2013, 05:05
Re: Essentials [17.04.2013] - by [Ro]DuReX - 17.04.2013, 13:07
Re: Essentials [17.04.2013] - by ReVo_ - 17.04.2013, 13:11
Re: Essentials [17.04.2013] - by -CaRRoT - 17.04.2013, 13:16
Re: Essentials [17.04.2013] - by [Ro]DuReX - 17.04.2013, 13:22
Re: Essentials [17.04.2013] - by ReVo_ - 17.04.2013, 13:45
Re: Essentials [17.04.2013] - by Red_Dragon. - 17.04.2013, 13:55
Re: Essentials [17.04.2013] - by NicholasA - 17.04.2013, 14:37
Re: Essentials [17.04.2013] - by [Ro]DuReX - 17.04.2013, 19:25

Forum Jump:


Users browsing this thread: 2 Guest(s)