SA-MP Forums Archive
Checkpoint Help - 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: Checkpoint Help (/showthread.php?tid=246425)



Checkpoint Help - Cenation - 04.04.2011

hi frnd, I have created 2 checkpoint and i want that if player enter in checkpoint he will teleport,

Код:
	if (strcmp("/warct", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid, COLOR_GREEN ,"You have teleported to Los Santos Airport Counter Terrorist WAR");
		SetPlayerInterior(playerid, 0);
		SetPlayerPos(playerid, 1940.221, -2530.451, 62.309);
		SetPlayerCheckpoint(playerid, 1950.182, -2520.425, 62.252, 1);
		return 1;
	}
	if (strcmp("/wart", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid, COLOR_GREEN ,"You have teleported to Los Santos Airport Terrorist WAR");
		SetPlayerInterior(playerid, 0);
		SetPlayerPos(playerid, 1909, -2518, 69);
		SetPlayerCheckpoint(playerid, 1929, -2509, 69, 1);
		return 1;
	}
	return 0;
}
for ex : in this in /warct i want him to teleport to 0.0.0 and in /wart 194, -257,1120
help me please
Sorry For Bad English


Re: Checkpoint Help - Hornet600 - 04.04.2011

i will post you de code how to do it in seconds


Re: Checkpoint Help - Hornet600 - 04.04.2011

pawn Код:
if (strcmp("/warct", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, COLOR_GREEN ,"You have teleported to Los Santos Airport Counter Terrorist WAR");
        SetPlayerInterior(playerid, 0);
        SetPlayerPos(playerid, 1940.221, -2530.451, 62.309);
        new ck1 = SetPlayerCheckpoint(playerid, 1950.182, -2520.425, 62.252, 1);
        return 1;
    }
    if (strcmp("/wart", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, COLOR_GREEN ,"You have teleported to Los Santos Airport Terrorist WAR");
        SetPlayerInterior(playerid, 0);
        SetPlayerPos(playerid, 1909, -2518, 69);
        new ck2 = SetPlayerCheckpoint(playerid, 1929, -2509, 69, 1);
        return 1;
    }
    public OnPlayerEnterCheckpoint(playerid)
    {
        new checkpoint;
        if(checkpoint == ck1)
        {
            // tp player to your positions
        }
        else if(checkpoint == ck2)
        {
            // tp player to your positions
        }
        return 1;
    }



Re: Checkpoint Help - Cenation - 04.04.2011

thankz dude!! u r great!!!


Re: Checkpoint Help - Cenation - 04.04.2011

Код:
E:\samp03csvr_win32\filterscripts\objectset.pwn(199) : warning 217: loose indentation
E:\samp03csvr_win32\filterscripts\objectset.pwn(204) : warning 204: symbol is assigned a value that is never used: "ck1"
E:\samp03csvr_win32\filterscripts\objectset.pwn(204 -- 207) : warning 217: loose indentation
E:\samp03csvr_win32\filterscripts\objectset.pwn(212) : warning 204: symbol is assigned a value that is never used: "ck2"
E:\samp03csvr_win32\filterscripts\objectset.pwn(220) : error 017: undefined symbol "ck1"
E:\samp03csvr_win32\filterscripts\objectset.pwn(224) : error 017: undefined symbol "ck2"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
tell me this please...


Re: Checkpoint Help - Ihsan-Cingisiz - 04.04.2011

Quote:
Originally Posted by Cenation
Посмотреть сообщение
Код:
E:\samp03csvr_win32\filterscripts\objectset.pwn(199) : warning 217: loose indentation
E:\samp03csvr_win32\filterscripts\objectset.pwn(204) : warning 204: symbol is assigned a value that is never used: "ck1"
E:\samp03csvr_win32\filterscripts\objectset.pwn(204 -- 207) : warning 217: loose indentation
E:\samp03csvr_win32\filterscripts\objectset.pwn(212) : warning 204: symbol is assigned a value that is never used: "ck2"
E:\samp03csvr_win32\filterscripts\objectset.pwn(220) : error 017: undefined symbol "ck1"
E:\samp03csvr_win32\filterscripts\objectset.pwn(224) : error 017: undefined symbol "ck2"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
tell me this please...
The CK variables are in a function, it must be local to use it in other functions too:
here it is:

Код:
new ck1, ck2;
if (strcmp("/warct", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, COLOR_GREEN ,"You have teleported to Los Santos Airport Counter Terrorist WAR");
        SetPlayerInterior(playerid, 0);
        SetPlayerPos(playerid, 1940.221, -2530.451, 62.309);
        ck1 = SetPlayerCheckpoint(playerid, 1950.182, -2520.425, 62.252, 1);
        return 1;
    }
    if (strcmp("/wart", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, COLOR_GREEN ,"You have teleported to Los Santos Airport Terrorist WAR");
        SetPlayerInterior(playerid, 0);
        SetPlayerPos(playerid, 1909, -2518, 69);
        ck2 = SetPlayerCheckpoint(playerid, 1929, -2509, 69, 1);
        return 1;
    }
    public OnPlayerEnterCheckpoint(playerid)
    {
        new checkpoint;
        if(checkpoint == ck1)
        {
            // tp player to your positions
        }
        else if(checkpoint == ck2)
        {
            // tp player to your positions
        }
        return 1;
    }
It should work now, not tested... Just put the 'new ck1, ck2" somewhere above your whole script...




Re: Checkpoint Help - (SF)Noobanatior - 04.04.2011

checkpoint will still always = 0