{-409.1236, 2244.5474, 42.4297} {-408.6208, 2224.4314, 42.4297} {-419.5130, 2229.0693, 42.4297} {-370.0843, 2242.7195, 45.8725} {-355.8813, 2241.0496, 45.5545} {-374.6754, 2232.2986, 42.4844} {-394.5614, 2259.2595, 42.1517}
public OnPlayerSpawn(playerid) {
new randomcoords = random(sizeof(variablename));
SetPlayerPos(playerid, variablename[randomcoords][0], variablename[randomcoords][1], variablename[randomcoords][2]);
return 1;
}
I don't mean anything by this, but is it hard to ****** something before posting?
https://sampforum.blast.hk/showthread.php?tid=162488 This tutorial explains it very well. |
There is no full code. This is DM mode that I am making. When connect player spawn in city and that is fine. But when he types /dm i want him to spawn on those coord i posted there. And i want every player to spawn on diferente coords (looping trought those i posted). Hope you understand
|
new Float:DMSpawn[][] = {
{-409.1236, 2244.5474, 42.4297},
{-408.6208, 2224.4314, 42.4297},
{-419.5130, 2229.0693, 42.4297},
{-370.0843, 2242.7195, 45.8725},
{-355.8813, 2241.0496, 45.5545},
{-374.6754, 2232.2986, 42.4844},
{-394.5614, 2259.2595, 42.1517}
};
public OnPlayerSpawn(playerid) {
new randomcoords = random(sizeof(DMSpawn));
SetPlayerPos(playerid, DMSpawn[randomcoords][0], DMSpawn[randomcoords][1], DMSpawn[randomcoords][2]);
return 1;
}
CMD:dm(playerid, params[])
CMD:dm(playerid, params[]) {
new randomcoords = random(sizeof(DMSpawn));
SetPlayerPos(playerid, DMSpawn[randomcoords][0], DMSpawn[randomcoords][1], DMSpawn[randomcoords][2]);
return 1;
}
new PlayerJoinedDMZone[MAX_PLAYERS];
PlayerJoinedDMZone[playerid] = 1;
public OnPlayerDeath(playerid, killerid, reason) {
if(PlayerJoinedDMZone[playerid] == 1) {
new randomcoords = random(sizeof(DMSpawn));
SetPlayerPos(playerid, DMSpawn[randomcoords][0], DMSpawn[randomcoords][1], DMSpawn[randomcoords][2]);
}
return 1;
}
CMD:leavedm(playerid, params[]) {
PlayerJoinedDMZone[playerid] = 0;
SendClientMessage(playerid, -1, "You've left the DM zone.");
return 1;
}