04.05.2016, 13:55
I have command which is changing the spawn point, here it is.
Command for setting faction spawn
pawn Код:
CMD:spawnpoint(playerid, params[])
{
new point;
if(sscanf(params, "i", point)) return SendErrorMessage(playerid, "/spawnpoint [0-2] (0 = Airport, 1 = Faction, 2 = Last logged)");
if(point == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "You've changed your spawn point to airport.");
PlayerData[playerid][pSpawnPoint] = 0;
return 1;
}
if(point == 1)
{
if(PlayerData[playerid][pFactionID] == -1)
{
SendErrorMessage(playerid, "You're not apart of a faction.");
return 1;
}
SendClientMessage(playerid, COLOR_WHITE, "You've changed your spawn to faction.");
PlayerData[playerid][pSpawnPoint] = 1;
return 1;
}
if(point == 2)
{
SendClientMessage(playerid, COLOR_WHITE, "You've changed your spawn to your last logged off.");
PlayerData[playerid][pSpawnPoint] = 2;
return 1;
}
return 1;
}
Command for setting faction spawn
pawn Код:
CMD:fspawn(playerid, params[])
{
new faction = PlayerData[playerid][pFactionID];
if (PlayerData[playerid][pFaction] == -1)
return SendErrorMessage(playerid, "You must be a faction leader.");
if (PlayerData[playerid][pFactionRank] < FactionData[PlayerData[playerid][pFaction]][factionRanks] - 5)
return SendErrorMessage(playerid, "You must be at least rank %d.", FactionData[PlayerData[playerid][pFaction]][factionRanks] - 5);
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
FactionData[faction][SpawnX] = X;
FactionData[faction][SpawnY] = Y;
FactionData[faction][SpawnZ] = Z;
FactionData[faction][SpawnInterior] = GetPlayerInterior(playerid);
FactionData[faction][SpawnVW] = GetPlayerVirtualWorld(playerid);
Faction_Save(faction);
SendClientMessage(playerid, COLOR_ORANGE, "You have changed your faction's spawn point. Faction members are now going to spawn here.");
return 1;
}