Some help for my minecraft-samp project.
#1

Some days ago a great idea came to my head. I thought: "What if i create a sa-mp server, where you can build world from blocks, like in minecraft?" First i started thinking about its possibility. And now i have made up my mind and I am ready to start! But there are some things i need to know, to start with.

The problem of this day:

Quote:
Originally Posted by pasha97
View Post
Can anybody help me with 1 more question? I have never used SetObjectMaterial before and i dont know how to use it. I need it to create a green flat terrain by setting an object color to green. I tried this:
pawn Code:
for(new i=0;i<42;i++)
       {
      SetObjectMaterial(idx[i], 0, -1, "none", "none", 0xFF00FF00); // ARGB format
       }
But it didn't work. What am i doing wrong?
Reply
#2

I can help you with the other thing, with creating the object exactly in front of the player.
It would be easy, you will just have to GetPlayerPos and just add something like 0.3 the x parameter. ( x+0.3 )
Should work.
Reply
#3

Quote:
Originally Posted by Denying
View Post
I can help you with the other thing, with creating the object exactly in front of the player.
It would be easy, you will just have to GetPlayerPos and just add something like 0.3 the x parameter. ( x+0.3 )
Should work.
That's not that easy, because it depends on player facing angle. This also must involve GetPlayerFacingAngle. In diffrent positions, adding some extra value to x parameter, will cause objects creating in front of player, in his left, in his right or behind him.
Reply
#4

Oh right, let me just check something in my script. I have this with my /make atm command.
I'll post a reply here in a few.

EDIT: I was wrong, it does not create it in front of you. My bad - sorry I could not help you.
Reply
#5

Cube object ID is already found. Now all I need is the second question: to find out how to create object exactly in front of a player by using his facing angle.

EDIT: I found the second solution too! Thanks to Y_Less for this:
pawn Code:
GetXYInFrontOfPlayer(playerid, &Float:XP, &Float:YP, Float:distance)
{       // Created by Y_Less
 
        new Float:a;
 
        GetPlayerPos(playerid, XP, YP, a);
        GetPlayerFacingAngle(playerid, a);
 
        if (GetPlayerVehicleID(playerid)) {
            GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
        }
 
        XP += (distance * floatsin(-a, degrees));
        YP += (distance * floatcos(-a, degrees));
}
Reply
#6

Can anybody help me with 1 more question? I have never used SetObjectMaterial before and i dont know how to use it. I need it to create a green flat terrain by setting an object color to green. I tried this:
pawn Code:
for(new i=0;i<42;i++)
       {
      SetObjectMaterial(idx[i], 0, -1, "none", "none", 0xFF00FF00); // ARGB format
       }
But it didn't work. What am i doing wrong?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)