Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Teleport to nearest CP

$
0
0
So the point of the story is that im trying to make a player teleport to nearest CP once he types /downroof.The hardest part is to make sure that player will teleport to nearest checkpoint once he interacts with organization checkpoint which gives him a dialog with roof teleport.So once the player types /downroof it auto tp's him down there since its the nearest CP.Im a newbie to scripting its kinda hard, no success yet.Check this command that has ability to add organization rooftop teleport, idk if it will be helpful..

Code:

CMD:addorgroof(playerid, params[])
{
        new giveplayerid, string[256];
        if (adlvl[playerid] < 6) return 0;
        if (sscanf(params, "d", giveplayerid)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /addorgroof [orgid]");
        format(string, 10, "org%d", giveplayerid);
        if (!dini_Exists(AddDirFile(dir_orgfiles, string))) return SendClientMessage2(playerid, COLOR_RED, "Error: Invalid organization id.");
        if (GetPlayerInterior(playerid) != 0) return SendClientMessage2(playerid, COLOR_RED, "Error: You are in an interior.");
        new Float:x, Float:y, Float:z, Float:a;
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngleFix(playerid, a);
        dini_FloatSet(AddDirFile(dir_orgfiles, string), "roofX", x);
        dini_FloatSet(AddDirFile(dir_orgfiles, string), "roofY", y);
        dini_FloatSet(AddDirFile(dir_orgfiles, string), "roofZ", z);
        dini_FloatSet(AddDirFile(dir_orgfiles, string), "roofA", a);
        SendPlayerFormattedText(playerid, COLOR_SILVER, "Roof positon for %s has been changed.", dini_Get(AddDirFile(dir_orgfiles, string), "name"), "");
        return 1;
}


Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>