Easy Prob needs solving
#1

Hey guys.

Please can you do a simple thing?

The Script below is the bare script

All i want is random spawn for these positions

1904.5405,-2449.6160,13.5391,326.2765,0,0,0,0,0,0);
1952.4174,-2448.5769,13.5391,29.8838,0,0,0,0,0,0);
1901.2076,-2349.4836,13.5391,223.8156,0,0,0,0,0,0);
1951.7904,-2350.2004,13.5391,140.1548,0,0,0,0,0,0);
1941.9075,-2378.0591,15.0297,140.1781,0,0,0,0,0,0);
1918.2415,-2408.9868,15.0297,345.7034,0,0,0,0,0,0);
1931.4423,-2442.0657,13.5391,9.1802,0,0,0,0,0,0);
1928.9292,-2426.5151,13.5391,9.1802,0,0,0,0,0,0);
1922.5577,-2387.0913,13.5391,9.1802,0,0,0,0,0,0);
1909.3179,-2394.5159,13.5391,112.8945,0,0,0,0,0,0);
1929.3574,-2410.2866,13.5391,184.9619,0,0,0,0,0,0);
1941.7374,-2438.8660,13.5391,222.5622,0,0,0,0,0,0);
1921.4889,-2421.2688,13.5391,81.2709,0,0,0,0,0,0);
1909.2271,-2410.2280,13.5391,55.5773,0,0,0,0,0,0);
1918.0038,-2409.0691,15.0297,332.2299,0,0,0,0,0,0);

Can you add a random spawn into the script below for me with thos positions?, I have tried and tried
i just cant do it.

Thanks guys!


--------------------------------------------------------------------

#include <a_samp>
#include <core>
#include <float>
#define COLOR_RED 0xAA3333AA
#define COLOR_SYSTEM 0xEFEFF7AA

#pragma tabsize 0


main()
{
print("\n----------------------------------");
print(" Bare Script\n");
print("----------------------------------\n");
}

public OnPlayerConnect(playerid)
{
GameTextForPlayer(playerid,"~w~SA-MP: ~r~Bare Script",5000,5);
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
new cmd[256];

cmd = strtok(cmdtext, idx);

if(strcmp(cmd, "/yadayada", true) == 0) {
SetPlayerPos(playerid, 2344.3156738281, -1668.4666748047, 1567.4560546875);
return 1;
}

return 0;
}

public OnPlayerSpawn(playerid)
{
SetPlayerInterior(playerid,0);
TogglePlayerClock(playerid,0);
return 1;


public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}

SetupPlayerForClassSelection(playerid)
{
SetPlayerInterior(playerid,14);
SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
SetPlayerFacingAngle(playerid, 270.0);
SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
}

public OnPlayerRequestClass(playerid, classid)
{
SetupPlayerForClassSelection(playerid);
return 1;
}

public OnGameModeInit()
{
SetGameModeText("Bare Script");
ShowPlayerMarkers(1);
ShowNameTags(1);
AllowAdminTeleport(1);

AddPlayerClass(265,1958.3783,1343.1572,15.3746,270 .1425,0,0,0,0,-1,-1);


return 1;
}

strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}

new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}

---------------------------------------------------------------------------------------------------------------
Reply
#2

https://sampwiki.blast.hk/wiki/Random
Reply
#3

Look into lvdm.pwn, there is all you need..
And that what Agent Smith said..
Reply
#4

pawn Код:
#include <a_samp>
new Float:SpawnRandom[15][3] = {
{1904.5405,-2449.6160,13.5391},
{1952.4174,-2448.5769,13.5391},
{1901.2076,-2349.4836,13.5391},
{1951.7904,-2350.2004,13.5391},
{1941.9075,-2378.0591,15.0297},
{1918.2415,-2408.9868,15.0297},
{1931.4423,-2442.0657,13.5391},
{1928.9292,-2426.5151,13.5391},
{1922.5577,-2387.0913,13.5391},
{1909.3179,-2394.5159,13.5391},
{1929.3574,-2410.2866,13.5391},
{1941.7374,-2438.8660,13.5391},
{1921.4889,-2421.2688,13.5391},
{1909.2271,-2410.2280,13.5391},
{1918.0038,-2409.0691,15.0297} };



public OnPlayerSpawn(playerid)
{
SetPlayerInterior(playerid,0);
TogglePlayerClock(playerid,0);
new rand=random(sizeof SpawnRandom);
SetPlayerPos(playerid,SpawnRandom[rand][0],SpawnRandom[rand][1],SpawnRandom[rand][2]);
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)