SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 27/02/2013, 10:19 AM   #1
newbienoob
High-roller
 
newbienoob's Avatar
 
Join Date: Jan 2012
Location: Follow the moaning coming from your parents' bedroom
Posts: 1,531
Reputation: 269
Default Last checkpoint was not destroyed

I have a problem with race checkpoint.

pawn Code:
public OnPlayerEnterDynamicRaceCP(playerid,checkpointid)
{
    if(checkpointid == cp[0])
    {
        cp[1] = CreateDynamicRaceCP(0,258.1696,2502.3184,16.0474,-78.5963,2498.3335,16.0418,10,200, .streamdistance = 500);
        DestroyDynamicRaceCP(cp[0]);
    }
    else if(checkpointid == cp[1])
    {
        cp[2] = CreateDynamicRaceCP(1,-78.5963,2498.3335,16.0418,-78.5963,2498.3335,16.0418,10,200, .streamdistance = 500);
        DestroyDynamicRaceCP(cp[1]);
    }
    else if(checkpointid == cp[2]) //This one doesn't work. I didn't receive "win" message and cp[2] was not destroyed.
    {
        SendClientMessage(playerid,-1,"win");
        DestroyDynamicRaceCP(cp[2]);
        SetPlayerVirtualWorld(playerid,0);
        return 1;
    }
    return 1;
}
I'm using streamer plugin.
__________________
Help me, please /a chat
newbienoob is offline   Reply With Quote
Old 27/02/2013, 10:27 AM   #2
[MG]Dimi
High-roller
 
[MG]Dimi's Avatar
 
Join Date: Mar 2011
Location: Serbia
Posts: 1,239
Reputation: 144
Default Re: Last checkpoint was not destroyed

How did you define cp[];?
__________________
Scripting Admin/Account/VIP Systems for $$$ using ZCMD,dcmd, Dini, MySQL and sscanf.Scripting IRC Systems with all possible functions. (Echo channels, Chat channels, Admin channels...)Long time Experience with IRC Systems.For both offers PM me
Mini Games ServerServer IP:178.238.236.62:7777
[MG]Dimi is offline   Reply With Quote
Old 27/02/2013, 11:41 AM   #3
newbienoob
High-roller
 
newbienoob's Avatar
 
Join Date: Jan 2012
Location: Follow the moaning coming from your parents' bedroom
Posts: 1,531
Reputation: 269
Default Re: Last checkpoint was not destroyed

new cp[3];
__________________
Help me, please /a chat
newbienoob is offline   Reply With Quote
Old 27/02/2013, 11:54 AM   #4
RajatPawar
High-roller
 
RajatPawar's Avatar
 
Join Date: Aug 2011
Location: ヽ༼ຈل͜ຈ༽ノ
Posts: 2,177
Reputation: 311
Default Re: Last checkpoint was not destroyed

How about using just 'else' on the last line (since it doesn't have any other choice) instead of 'else if'? Or using switch statements?
RajatPawar is offline   Reply With Quote
Old 27/02/2013, 12:47 PM   #5
DaRk_RaiN
Gangsta
 
DaRk_RaiN's Avatar
 
Join Date: Sep 2012
Posts: 973
Reputation: 207
Default Re: Last checkpoint was not destroyed

Quote:
Originally Posted by Rajat_Pawar View Post
How about using just 'else' on the last line (since it doesn't have any other choice) instead of 'else if'? Or using switch statements?
He can't switch statements in this situation.
DaRk_RaiN is offline   Reply With Quote
Old 27/02/2013, 12:48 PM   #6
newbienoob
High-roller
 
newbienoob's Avatar
 
Join Date: Jan 2012
Location: Follow the moaning coming from your parents' bedroom
Posts: 1,531
Reputation: 269
Default Re: Last checkpoint was not destroyed

I don't think that's the problem. + I will get an errors if I do that.
__________________
Help me, please /a chat
newbienoob is offline   Reply With Quote
Old 27/02/2013, 12:50 PM   #7
Riddick94
Banned
 
Join Date: Mar 2010
Location: Poland
Posts: 1,767
Reputation: 223
Default Re: Last checkpoint was not destroyed

Yes, he can use switch.
Riddick94 is offline   Reply With Quote
Old 27/02/2013, 12:53 PM   #8
newbienoob
High-roller
 
newbienoob's Avatar
 
Join Date: Jan 2012
Location: Follow the moaning coming from your parents' bedroom
Posts: 1,531
Reputation: 269
Default Re: Last checkpoint was not destroyed

pawn Code:
switch (checkpointid)
    {
        case cp[0]:
        {
            cp[1] = CreateDynamicRaceCP(0,258.1696,2502.3184,16.0474,-78.5963,2498.3335,16.0418,10,200, .streamdistance = 500);
            DestroyDynamicRaceCP(cp[0]);
        }
?

Can't.
__________________
Help me, please /a chat
newbienoob is offline   Reply With Quote
Old 27/02/2013, 12:54 PM   #9
Riddick94
Banned
 
Join Date: Mar 2010
Location: Poland
Posts: 1,767
Reputation: 223
Default Re: Last checkpoint was not destroyed

pawn Code:
#include    <a_samp>
#include    <streamer>

new cp[3];

public OnPlayerEnterDynamicRaceCP(playerid, checkpointid)
{
    for(new i = 0; i < 3; i++)
    {
        if(checkpointid == cp[i])
        {
            switch(i)
            {
                case 0:
                {
                    DestroyDynamicRaceCP(cp[0]);
                    cp[1] = CreateDynamicRaceCP(0,258.1696,2502.3184,16.0474,-78.5963,2498.3335,16.0418,10,200, .streamdistance = 500);
                }

                case 1:
                {
                    DestroyDynamicRaceCP(cp[1]);
                    cp[2] = CreateDynamicRaceCP(1,-78.5963,2498.3335,16.0418,-78.5963,2498.3335,16.0418,10,200, .streamdistance = 500);
                }

                case 2:
                {
                    SendClientMessage(playerid, -1, "win");
                    DestroyDynamicRaceCP(cp[2]);
                    SetPlayerVirtualWorld(playerid,0);
                }
            }
        }
    }
    return true;
}
Riddick94 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Car will not spawn away (get destroyed) EAsT-OAK_510 Scripting Help 1 28/11/2012 01:59 AM
how to detect specified object is destroyed akhilarora123 Scripting Help 0 03/06/2012 03:02 PM
Spawning destroyed cars? DaneAMattie Help Archive 5 18/08/2010 06:00 PM
Checkpoint not being destroyed NewTorran Help Archive 2 07/06/2010 08:30 PM
Textdraws not getting destroyed ? am0k Help Archive 3 04/09/2009 09:57 PM


All times are GMT. The time now is 09:07 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.