SA-MP Forums Archive
How to do this? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to do this? (/showthread.php?tid=171618)



How to do this? - rbN. - 27.08.2010

So, I got this:

pawn Код:
forward StuntCompleted(playerid);
public StuntCompleted(playerid)
{
    new stuntid = GetStuntID(playerid);
    for(new i=0; i<MAX_STUNTS; i++)
    {
        GivePlayerMoney(playerid, StuntMoney[i]);
        new str2[128];
        format(str2, sizeof(str2), "You have received %d dollars and %d score", StuntMoney[stuntid], StuntScore[stuntid]);
        SendClientMessage(playerid, c_y, str2);
        SetPlayerScore(playerid, (GetPlayerScore(playerid))+ StuntScore[stuntid]);
        TogglePlayerDynamicCP(playerid, StuntCheckpoint[stuntid], 0);
    }
    return 1;
}
The problem is, that if I use stuntid, that nothing happens, but if I use i, it happens on all the checkpoints, and I always get all the score and money that are defined.. So I only want that the checkpoint I entered goes away for only myself, and that I get the score and money that I defined.

Example:

pawn Код:
AddStunt(stuntid, Float:iconX, Float:iconY, Float:iconZ, Moneya, Scorea)

   AddStunt(0, 1303.040405,1291.831787,68.269271, 110,1); //stunt1
So, how to do that I only get the money and score for the checkpoint im standing in, and that the checkpoint disappears after that?


Re: How to do this? - iggy1 - 27.08.2010

You tryed using "IsPlayerInRangeOfPoint" in "OnPlayerEnterCheckpoint" to check whether the player is in range of the given checkpoint then "DisablePlayerCheckpoint"? Not sure if thats what yyou want. Mght work.

I use incognitos streamer plugin and could think of an easy way with that, but i dont realy use the standard pawno checkpoint functions.


Re: How to do this? - rbN. - 27.08.2010

Quote:
Originally Posted by iggy1
Посмотреть сообщение
Tryed using IsPlayerInRangeOfPoint in OnPlayerEnterCheckpoint to check whether the player is in range of the checkpoint then DisablePlayerCheckpoint? Not sure if thats what yyou want. Mght work.

I use incognitos streamer plugin and could think of an easy way with that, but i dont realy use the standard pawno checkpoint functions.
Yo iggy <3 I got incognito too now :P..

Well, I mean like: When your in the checkpoint, it checks which AddStunt it is, and then it deletes that checkpoint..

So uh, like.. You enter the checkpoint --> Only that checkpoint goes away, and not all that are in AddStunt


Re: How to do this? - iggy1 - 27.08.2010

Well the steamer has playerid parameter so you could do this

At top with other variables
pawn Код:
enum Stunts
{
    stunt1,
    stunt2,
    stunt3
    //and so on
};

new pCheckpoint[MAX_PLAYERS][Stunts];
Then where you need to create the players checkpoint
pawn Код:
pCheckpoint[playerid][stunt1] = CreateDynamicCP(x,y,z,7.0,-1,-1,playerid,70.0);//note it wll only be  created for 'playerid'
Then finally
pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(checkpointid == pCheckpoint[playerid][stunt1])
    {
        //do stuff here
        DestroyDynamicCP(pCheckpoint[playerid][stunt1]);
    }
    return 1;
}
That might work