Jump to content
  • 0

Problema spawn random


Andronache

Question

Salutare! Ma tot chinui sa fac ca atunci cand cumperi de la dealership o masina, sa ti-o spawneze random in mai multe locuri de parcare si singura idee cat de cat buna care mi-a venit a fost asta


new Float: RandX[][15] = {

    {278.8145, 281.6742, 284.8488, 288.0353, 290.8527, 294.1170, 297.6694, 300.4866, 303.6009, 299.8587, 303.6159, 306.2278, 297.8833, 294.2142, 291.8749}

};
new Float: RandY[][15] = {

    {-1535.9930, -1531.5852, -1527.3562, -1522.2322, -1517.6438, -1513.8531, -1508.7517, -1504.1326, -1500.1302, -1490.9858, -1486.4880, -1481.9978, -1535.7963, -1539.6815, -1544.3756}

};
new Float: RandZ[][15] = {

    {24.3214, 24.3208, 24.3208, 24.3208, 24.3208, 24.3208, 24.3207, 24.3244, 24.3278, 24.3208, 24.3208, 24.3208, 24.3208, 24.3208, 24.3208}

};





        PlayerInfo[playerid][pCarLocX][idcar] = random(sizeof(RandX));
        PlayerInfo[playerid][pCarLocY][idcar] = random(sizeof(RandY));
        PlayerInfo[playerid][pCarLocZ][idcar] = random(sizeof(RandZ));



Compilatorul ruleaza, adica oarecum merge ce am facut, doar ca imi apar 3 warninguri care spun ca RandX, RandY si RandZ nu sunt folosite niciodata. Alte idei nu mi-au mai venit:)) Aveti voi vreo idee care sa aiba o eficienta mai buna?
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Pai nu asa se face... In primul rand inlocuieste cei 15 parametri cu doar 4(X,Y,Z,Rotation).

Dupa accea adauga coordonatele pe mai multe randuri:

new Float: dsPos[][4] = {
  {X, Y, Z, R},
  {X, Y, Z, R},
  {X, Y, Z, R}
}

Si dupa accea faci in felul urmator:

new dsPosition = random(sizeof(dsPos));

dsPos[dsPosition][0] | dsPos[dsPosition][1] | dsPos[dsPosition][2] | dsPos[dsPosition][3]

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.