SA-MP Forums Archive
very very verrryy small [question] - 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: very very verrryy small [question] (/showthread.php?tid=278978)



very very verrryy small [question] - boelie - 24.08.2011

Hello,

just a small mindtwist while im scripting to make some random coordinates

if i do this...lets say in a command

pawn Code:
pickup = CreatePickup(1279,1,RandomDelivery[randD][0],RandomDelivery[randD][1],RandomDelivery[randD][2],0);
SetPlayerMapIcon( playerid, 12, RandomDelivery[randD][0],RandomDelivery[randD][1],RandomDelivery[randD][2], 52, 0, MAPICON_GLOBAL);

will both show the same random ? Oo
if not then how should i do that?


Re: very very verrryy small [question] - Toreno - 24.08.2011

Here is one way, at least that's how it looks like, haven't tested it;
BTW, the _SetPlayerMapIcon stock should be on top since I defined it as regular one.
pawn Code:
#define MAX_MAPICON 100
pawn Code:
enum mIcon {
    Float:mx,
    Float:my,
    Float:mz
}
new
    MapIcon[MAX_PLAYERS][MAX_MAPICON][mIcon],
    Icon1;
pawn Code:
stock _SetPlayerMapIcon(playerid, iconid, Float:x, Float:y, Float:z, markertype, color, style) {
    MapIcon[playerid][iconid][mx] = x;
    MapIcon[playerid][iconid][my] = y;
    MapIcon[playerid][iconid][mz] = z;
    return SetPlayerMapIcon(playerid, iconid, x, y, z, markertype, color, style);
}
#define SetPlayerMapIcon _SetPlayerMapIcon
pawn Code:
stock GetPlayerMapIcon(playerid, iconid, Float:x, Float:y, Float:z) {
    x = MapIcon[playerid][iconid][mx];
    y = MapIcon[playerid][iconid][my];
    z = MapIcon[playerid][iconid][mz];
    return 1;
}
pawn Code:
new Float:C[3];
Icon1 = SetPlayerMapIcon(playerid, 12, RandomDelivery[randD][0],RandomDelivery[randD][1],RandomDelivery[randD][2], 52, 0, MAPICON_GLOBAL);
GetPlayerMapIcon(playerid, Icon1, C[0], C[1], C[2]);
pickup = CreatePickup(1279,1, C[0], C[1], C[2],0);