Making Checkpoint automatically - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Making Checkpoint automatically (
/showthread.php?tid=559769)
Making Checkpoint automatically -
Arxalan - 25.01.2015
Hello , is there any way to make auto checkpoint . I mean i want to set checkpoint in front of biz. So when i create a biz a checkpoint also create in some distance.I know it is impossible to do something without code i.e. my biz coding but tell me how to do . Give me idea.
Re: Making Checkpoint automatically -
TFreemen - 25.01.2015
You want to create a checkpoint with your business?
Re: Making Checkpoint automatically -
Arxalan - 25.01.2015
Yes , i want to create a checkpoint with my biz.
Re: Making Checkpoint automatically -
nezo2001 - 25.01.2015
show ur biz code
Re: Making Checkpoint automatically -
Arxalan - 25.01.2015
PHP код:
COMMAND:createbiz(playerid, params[])
{
// If a player hasn't logged in properly, he cannot use this command
if (INT_IsPlayerLoggedIn(playerid) == 0) return 0;
// If the player has an insufficient admin-level (he needs level 5 or RCON admin), exit the command
// returning "SERVER: Unknown command" to the player
if (INT_CheckPlayerAdminLevel(playerid, 5) == 0) return 0;
// Setup local variables
new HPrice, MaxLevel, bizID;
// Check if the player isn't inside a vehicle (the admin-player must be on foot to use this command)
if (GetPlayerVehicleSeat(playerid) == -1)
{
if (sscanf(params, "ii", HPrice, MaxLevel)) SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Usage: \"/createbiz <price> <maxlevel (1-10)>\"");
else
{
// Check if the player entered a proper maxlevel
if ((MaxLevel >= 1) && (MaxLevel <= 10))
{
// Find the first free bizID
for (bizID = 1;bizID < MAX_BIZES; bizID++)
if (!IsValidDynamicPickup(AbizData[bizID][PickupID])) // Check if an empty biz-index has been found (PickupID is 0)
break; // Stop searching, the first free bizID has been found now
// Check if the biz-limit hasn't been reached yet
// This would seem to double-check the pickup-id, but in case there was no free bizslot found (bizID points
// to the last index, the last index would hold a biz, so be sure to not overwrite it
if (!IsValidDynamicPickup(AbizData[bizID][PickupID]))
{
// Setup some local variables
new Float:x, Float:y, Float:z, Msg[128];
// Get the player's position
GetPlayerPos(playerid, x, y, z);
// Set some default data
AbizData[bizID][Owned] = false;
AbizData[bizID][Owner] = 0;
AbizData[bizID][bizX] = x;
AbizData[bizID][bizY] = y;
AbizData[bizID][bizZ] = z;
AbizData[bizID][bizLevel] = 1;
AbizData[bizID][bizMaxLevel] = MaxLevel;
AbizData[bizID][bizPrice] = HPrice;
AbizData[bizID][bizOpened] = false;
// Add the pickup and 3DText at the location of the biz-entrance (where the player is standing when he creates the biz)
biz_UpdateEntrance(bizID);
// Save the biz
bizFile_Save(bizID);
// Inform the player that he created a new biz
format(Msg, 128, "{00FF00}You've succesfully created a biz with ID: {FFFF00}%i", bizID);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}The maximum amount of bizhas been reached");
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You have to use a max-level from 1 to 10");
}
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You must be on foot to create a biz");
// Let the server know that this was a valid command
return 1;
}