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



Help with command. - cepiokas - 02.10.2009

So. I'm creatin' my RP server from 0. So. I want to make entrance. my bulding is in LS Airport ( building build from empty garages. It's like walls. It without interior ). I want, that when i type command, player gonna be teleported there. My code:
Код:
if(!strcmp(cmdtext, "/enter", true)) // Entrance
	{
	if(PlayerToPoint(1,playerid,2458.3530,1327.0610,10.8203))
	{
	SetPlayerPos(playerid,1960.8862,-2347.9216,13.5469)
	return 1;
	}
	}
I'm get this error:
Код:
C:\Documents and Settings\Samsung\Desktop\LTRP\gamemodes\LTRP.pwn(141) : error 010: invalid function or declaration
C:\Documents and Settings\Samsung\Desktop\LTRP\gamemodes\LTRP.pwn(143) : error 010: invalid function or declaration
C:\Documents and Settings\Samsung\Desktop\LTRP\gamemodes\LTRP.pwn(146) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
141 line:
Код:
if(!strcmp(cmdtext, "/enter", true)) // Entrance
143 line:
Код:
if(PlayerToPoint(1,playerid,2458.3530,1327.0610,10.8203))
146 line:
Код:
return 1;
Thanks for help.


Re: Help with command. - ded - 02.10.2009

pawn Код:
if(!strcmp(cmdtext, "/enter", true)) // Entrance
Basically telling the script if you type anything but /enter teleport me to 2458.3530,1327.0610,10.8203.

pawn Код:
if(strcmp(cmdtext, "/enter", true) ==0) // Entrance



Re: Help with command. - cepiokas - 02.10.2009

Nothing.


Re: Help with command. - Peter_Corneile - 02.10.2009

Try this

pawn Код:
if (strcmp("/enter", cmdtext, true, 6) == 0) //entrance
    {
    if(PlayerToPoint(1,playerid,2458.3530,1327.0610,10.8203))
    {
    SetPlayerPos(playerid,1960.8862,-2347.9216,13.5469)
    return 1;
    }
    }



Re: Help with command. - ded - 02.10.2009

You don't need the 6 there. Waste of time putting the 6 there.


Re: Help with command. - Peter_Corneile - 02.10.2009

Quote:
Originally Posted by » Pawnst★r «
You don't need the 6 there. Waste of time putting the 6 there.
However , it might work (compile) for him


Re: Help with command. - cepiokas - 02.10.2009

Still nothing. Maybe there need some PlayerToPoint stock ar public?


Re: Help with command. - Peter_Corneile - 02.10.2009

pawn Код:
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);

public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
  if(IsPlayerConnected(playerid))
    {
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        tempposx = (oldposx -x);
        tempposy = (oldposy -y);
        tempposz = (oldposz -z);
       
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
    }
    return 0;
}



Re: Help with command. - cepiokas - 02.10.2009

Damn, nothing. Ok. Then maybe someone know how to make entrance's in another way?


Re: Help with command. - Peter_Corneile - 02.10.2009

I would recommend you to use a Pickup .. And make the entrance under OnPlayerPickupPickup