SA-MP Forums Archive
2 Player To Points, 1 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: 2 Player To Points, 1 Command (/showthread.php?tid=115180)



2 Player To Points, 1 Command - sidhu123 - 22.12.2009

Hello! I'm currently working on a script and am almost done!
I'm trying to do something new with this script and need a little assistance.

I'm making a command that would work if your at 1 of 2 places.

Eg.

I'm at the airport and theres a gate. I could be behind the gate OR in front of that gate (2 places I could be).
How would I set 2 Player To Points for 1 command?


Thanks!


Re: 2 Player To Points - Nero_3D - 22.12.2009

if your gate have special points like

O|
|
|O

Then you could use if(IsPlayerInRangeOfPoint(...) || IsPlayerInRangeOfPoint(...))

if you just want that you can use the command on both sides

------
| | |
| | |
| | |
------


then you could use if(IsPlayerInArea(...))


Re: 2 Player To Points, 1 Command - adsy - 22.12.2009

similar to what ive been doing by the sounds of it

http://forum.sa-mp.com/index.php?top...4916#msg844916

Код:
    if(IsPlayerInRangeOfPoint(playerid, 4.0, -2409.3364,-2189.7725,34.0391)){
     if(!strcmp("/lift", cmd)) { //Works with or without the !
        SetPlayerPos(playerid,-2232.8716,-1737.5121,480.8323);
     }
    }
id just place a line like this in:

Код:
    if(IsPlayerInRangeOfPoint(playerid, 4.0, -2409.3364,-2189.7725,34.0391) || IsPlayerInRangeOfPoint(playerid, 4.0, -2409.3364,-2189.7725,34.0391)){ //HERE!!
     if(!strcmp("/lift", cmd)) { //Works with or without the !
        SetPlayerPos(playerid,-2232.8716,-1737.5121,480.8323);
     }
    }
note the ||

that means or


Re: 2 Player To Points - sidhu123 - 22.12.2009

Quote:
Originally Posted by ♣ ⓐⓢⓢ
if your gate have special points like

O|
|
|O

Then you could use if(IsPlayerInRangeOfPoint(...) || IsPlayerInRangeOfPoint(...))

if you just want that you can use the command on both sides

------
| | |
| | |
| | |
------


then you could use if(IsPlayerInArea(...))
It's like the first example.


Quote:
Originally Posted by adsy
similar to what ive been doing by the sounds of it

http://forum.sa-mp.com/index.php?top...4916#msg844916

Код:
    if(IsPlayerInRangeOfPoint(playerid, 4.0, -2409.3364,-2189.7725,34.0391)){
     if(!strcmp("/lift", cmd)) { //Works with or without the !
        SetPlayerPos(playerid,-2232.8716,-1737.5121,480.8323);
     }
    }
id just place a line like this in:

Код:
    if(IsPlayerInRangeOfPoint(playerid, 4.0, -2409.3364,-2189.7725,34.0391) || IsPlayerInRangeOfPoint(playerid, 4.0, -2409.3364,-2189.7725,34.0391)){ //HERE!!
     if(!strcmp("/lift", cmd)) { //Works with or without the !
        SetPlayerPos(playerid,-2232.8716,-1737.5121,480.8323);
     }
    }
note the ||

that means or
Ahh okay. I'll be sure to try this method

Thanks!


Re: 2 Player To Points, 1 Command - sidhu123 - 22.12.2009

Okay well, it didn't go so well.

I can open the door but when I'm not at the keypad and type /frntopen, it says Unknown Command and not "You are too far from the keypad".

After opening the gate, if I type /frntclose, it says "You are too far from the keypad" even if I'm right in front of it.

This is the code.
http://pastebin.com/m1802aa84

Could someone please help me fix this.


Re: 2 Player To Points, 1 Command - adsy - 22.12.2009

have you tried from both locations?


Re: 2 Player To Points, 1 Command - sidhu123 - 22.12.2009

Quote:
Originally Posted by adsy
have you tried from both locations?
Yup.


Re: 2 Player To Points, 1 Command - adsy - 22.12.2009

can you add this function outside onplayercommandtext:

Код:
public OnPlayerSpawn(playerid)
{
  SetPlayerCheckpoint(playerid, 2425.4812,-2100.0002,13.5469, 3.0);
  SetPlayerCheckpoint(playerid, 2423.1638,-2078.8130,13.5538, 3.0);
  return 1;
}
then see if theres a checkpoint in the correct places

ps set a teleport script up if you havent already to coordinates right nearby

like this:

Код:
 if(!strcmp("/test", cmd)) {
    SetPlayerPos(playerid,-2419.3364,-2179.7725,34.0391);
 }
(that ones for the mountain hut)


Re: 2 Player To Points, 1 Command - lolumadd - 22.12.2009

Quote:
Originally Posted by adsy
similar to what ive been doing by the sounds of it

http://forum.sa-mp.com/index.php?top...4916#msg844916

Код:
    if(IsPlayerInRangeOfPoint(playerid, 4.0, -2409.3364,-2189.7725,34.0391)){
     if(!strcmp("/lift", cmd)) { //Works with or without the !
        SetPlayerPos(playerid,-2232.8716,-1737.5121,480.8323);
     }
    }
id just place a line like this in:

Код:
    if(IsPlayerInRangeOfPoint(playerid, 4.0, -2409.3364,-2189.7725,34.0391) || IsPlayerInRangeOfPoint(playerid, 4.0, -2409.3364,-2189.7725,34.0391)){ //HERE!!
     if(!strcmp("/lift", cmd)) { //Works with or without the !
        SetPlayerPos(playerid,-2232.8716,-1737.5121,480.8323);
     }
    }
note the ||

that means or
Why are you helping people if you have no idea what you are doing? Sidhu comes to on msn wondering why it doesnt work, he shows me this topic and I do a facepalm.

Example:

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 4.0, -2409.3364,-2189.7725,34.0391)){
     if(!strcmp("/lift", cmd)) { //Works with or without the !
When has a if statement ever come above the command? I mean, really? My first day of scripting I knew better than this, its just fuckin common scense. You dont even know how to do a command correctly.
pawn Код:
if(!strcmp("/lift", cmd)) //Works with or without the !
I believe it is...

pawn Код:
if(strcmp(cmdtext, "/lift", true, 5) == 0)
Those are totally different. In yours, you forgot the "true" and the ammount of letters which means it will definitely not work.
Oh wait
Quote:

//Works with or without the !

Yea.... lets try
pawn Код:
if(strcmp("/lift", cmd))
That makes a difference.

Im sorry if Im being harsh but some people on this forum actually need the code right or they will not understand so we dont need noobs like you giving false information.

http://wiki.sa-mp.com

kthx


Re: 2 Player To Points, 1 Command - sidhu123 - 23.12.2009

Worked!

Thank you lolumadd!