How would I go about doing this?
#1

I'm thinking of a vehicle system designated by IDs, meaning the position of your boat is determined by your ID.

At the moment I have:

pawn Код:
new
    g_BoatID = 0,
        p_BoatID[MAX_PLAYERS char] = -1
;
OnPlayerConnect I have:

pawn Код:
g_BoatID++;
Now, my question is, can I place the coordinates in an array, and load them like:

pawn Код:
p_BoatID{playerid} = CreateVehicle(572, BoatPos[g_BoatIDX][playerid], BoatPos[BoatIDY][playerid], BoatPos[BoatIDZ][playerid], BoatPos[BoatA][playerid] ..);
Reply
#2

Meh, before to skip to anything. Your code wont work if you have more then "0xFF(255)" cars, don't use a CHAR array to cure this.
Reply
#3

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
Meh, before to skip to anything. Your code wont work if you have more then "0xFF(255)" cars, don't use a CHAR array to cure this.
Well, It was planned to be more of a smaller type gamemode, that's the reason I used char; although I appreciate your concern. Could you assist me further?
Reply
#4

yes, i can.

pawn Код:
static const
    Float: g_BoatSpawns[ ] [ 4 ] =
    {
        { 1.0, 1.0, 1.0, 360.0 }, // Keep making rows till you reach your servers slots.
        { 1.0, 1.0, 1.0, 360.0 }
    }
;
To answer to:
Quote:

Now, my question is, can I place the coordinates in an array, and load them like:

Reply
#5

Okay, so as to your answer (which I appreciate by the way)..

How would I use that?

pawn Код:
CreateVehicle(572, g_BoatSpawns[0][playerid], g_BoatSpawns[1][playerid], g_BoatSpawns[2][playerid], g_BoatSpawns[3][playerid], 0, 0);
with 0 being x, 1 being y, 2 being z, and 3 being the angle?

Perhaps I should explain, the playerid statement I wanted to be another way to get the row. Meaning if my ID was 0, it would get row 0, et cetera.. Hopefully the code I posted above explained itself though, cause I'm a man of few words..
Reply
#6

Quote:
Originally Posted by 2KY
Посмотреть сообщение
Okay, so as to your answer (which I appreciate by the way)..

How would I use that?

pawn Код:
CreateVehicle(572, g_BoatSpawns[0][playerid], g_BoatSpawns[1][playerid], g_BoatSpawns[2][playerid], g_BoatSpawns[3][playerid], 0, 0);
with 0 being x, 1 being y, 2 being z, and 3 being the angle?

Perhaps I should explain, the playerid statement I wanted to be another way to get the row. Meaning if my ID was 0, it would get row 0, et cetera.. Hopefully the code I posted above explained itself though, cause I'm a man of few words..
Bump. I really need an answer to this as soon as possible.
Reply
#7

Something like this could do:

pawn Код:
for(new i = 0; i < sizeof(g_BoatSpawns); i++)
{
    CreateVehicle(572, g_BoatSpawns[0][playerid], g_BoatSpawns[1][playerid], g_BoatSpawns[2][playerid], g_BoatSpawns[3][playerid], 0, 0);
}
Reply
#8

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Something like this could do:

pawn Код:
for(new i = 0; i < sizeof(g_BoatSpawns); i++)
{
    CreateVehicle(572, g_BoatSpawns[0][playerid], g_BoatSpawns[1][playerid], g_BoatSpawns[2][playerid], g_BoatSpawns[3][playerid], 0, 0);
}
Thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)