SA-MP Forums Archive
Problem with checkpoints and CreateObject - 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: Problem with checkpoints and CreateObject (/showthread.php?tid=399842)



Problem with checkpoints and CreateObject - MattSlater - 16.12.2012

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!


Re: Problem with checkpoints and CreateObject - maramizo - 16.12.2012

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?


Re: Problem with checkpoints and CreateObject - MattSlater - 16.12.2012

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);




Re: Problem with checkpoints and CreateObject - maramizo - 16.12.2012

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


Re: Problem with checkpoints and CreateObject - MattSlater - 16.12.2012

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.


Re: Problem with checkpoints and CreateObject - MattSlater - 16.12.2012

Anyone??


Re: Problem with checkpoints and CreateObject - Red_Dragon. - 16.12.2012

Use DestroyObject before each one


Re: Problem with checkpoints and CreateObject - MattSlater - 16.12.2012

What do you mean?

Like once it's created it, destroy it?

If so, I need them placed


Re: Problem with checkpoints and CreateObject - maramizo - 16.12.2012

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.


Re: Problem with checkpoints and CreateObject - MattSlater - 16.12.2012

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