Problem with checkpoints and CreateObject
#1

pawn Код:
if(GetPVarInt(playerid, "Farming") == 2) {
        farmerCrop[0] = CreateObject(872, -1190.1591, -1058.8303, 128.0696, 0, 0, 0);
        TogglePlayerControllable(playerid, 1);
        SetPVarInt(playerid, "Farming", 3);
        SetPlayerCheckpoint(playerid, -1164.7809, -1059.2003, 129.2188, 4.0);
        GameTextForPlayer(playerid, "~g~+$10", 1000, 1);
        GivePlayerCash(playerid, 10);
    }
    else if(GetPVarInt(playerid, "Farming") == 3) {
        farmerCrop[1] = CreateObject(872, -1164.7809, -1059.2003, 128.0696, 0, 0, 0);
        TogglePlayerControllable(playerid, 1);
        SetPVarInt(playerid, "Farming", 4);
        SetPlayerCheckpoint(playerid, -1173.5958, -1032.9147, 129.2188, 4.0);
        GameTextForPlayer(playerid, "~g~+$10", 1000, 1);
        GivePlayerCash(playerid, 10);
    }
    else if(GetPVarInt(playerid, "Farming") == 4) {
        farmerCrop[2] = CreateObject(872, -1173.5958, -1032.9147, 128.0696, 0, 0, 0);
        TogglePlayerControllable(playerid, 1);
        SetPVarInt(playerid, "Farming", 5);
        SetPlayerCheckpoint(playerid, -1150.0453, -1029.7294, 128.0188, 4.0);
        GameTextForPlayer(playerid, "~g~+$10", 1000, 1);
        GivePlayerCash(playerid, 10);
    }
    else if(GetPVarInt(playerid, "Farming") == 5) {
        farmerCrop[3] = CreateObject(872, -1150.0453, -1029.7294, 128.0188, 0, 0, 0); // THIS ONE HERE
        TogglePlayerControllable(playerid, 1);
        SetPVarInt(playerid, "Farming", 6);
        SetPlayerCheckpoint(playerid, -1115.7924, -1036.8137, 129.2188, 4.0); // IT CREATES IT AT THAT LOCATION
        GameTextForPlayer(playerid, "~g~+$10", 1000, 1);
        GivePlayerCash(playerid, 10);
    }
    else if(GetPVarInt(playerid, "Farming") == 6) {
        farmerCrop[4] = CreateObject(872, -1115.7924, -1036.8137, 129.2188, 0, 0, 0);
        TogglePlayerControllable(playerid, 1);
        SetPVarInt(playerid, "Farming", 7);
        SetPlayerCheckpoint(playerid, -1113.9963, -1014.8454, 129.2188, 4.0);
        GameTextForPlayer(playerid, "~g~+$10", 1000, 1);
        GivePlayerCash(playerid, 10);
    }
Is my code, when they enter '-1150.0453, -1029.7294, 128.0188' checkpoint, it doesn't create the object at that co-ordinates, it creates it at the next checkpoint, any help on this?

I cannot get around it, it does it for the rest after that, but the first 3 createobjects are fine!
Reply
#2

Quote:
Originally Posted by MattSlater
Посмотреть сообщение
it doesn't create the object at that co-ordinates, it creates it at the next checkpoint
What do you mean by the next checkpoint?
Reply
#3

Well, i did a comment(//) on the next checkpoint, the co-ordinates on that comment is where it creates the object, if that makes sense?

Quote:

farmerCrop[3] = CreateObject(872, -1150.0453, -1029.7294, 128.0188, 0, 0, 0);

On here, it doesn't create the object at the co-ordinates that are in there which is (-1150.0453, -1029.7294, 128.018 but instead it creates it at the SetPlayerCheckpoint co-ordinates which is this:
Quote:

SetPlayerCheckpoint(playerid, -1115.7924, -1036.8137, 129.2188, 4.0);

Reply
#4

I'd recommend you DestroyObject at each location of the previous object spawned, or using incognito's streamer.
Reply
#5

I need them all spawned at the same time though?

Anyone else got any ideas why it's doing this?

What if I did CreateDynamicObject instead?

EDIT: CreateDynamicObject didn't fix it.
Reply
#6

Anyone??
Reply
#7

Use DestroyObject before each one
Reply
#8

What do you mean?

Like once it's created it, destroy it?

If so, I need them placed
Reply
#9

Quote:
Originally Posted by MattSlater
Посмотреть сообщение
What do you mean?

Like once it's created it, destroy it?

If so, I need them placed
Use incognito's streamer, and change ALL your CreateObject to CreateDynamicObject.
Reply
#10

Quote:
Originally Posted by maramizo
Посмотреть сообщение
Use incognito's streamer, and change ALL your CreateObject to CreateDynamicObject.
Already have, still messes up
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)