Need your help -
canip - 16.05.2016
Hello samp forum.
I have created this /enter & /exit command. There's two shops, there goes to the same place.
Here's the code
Код:
CMD:enter(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, 1553.779052, -1675.300048, 16.195312))
{
SetPlayerPos(playerid, 246.6695, 65.8039, 1003.6406);//PD
SetPlayerInterior(playerid, 6);
}
if(IsPlayerInRangeOfPoint(playerid, 3.0, 1929.604980, -1776.355957, 13.546875))
{
SetPlayerPos(playerid, -25.7220, -187.8216, 1003.5469);//Shop1
SetPlayerInterior(playerid, 17);
}
if(IsPlayerInRangeOfPoint(playerid, 3.0, 2423.711181, -1742.248657, 13.546875))
{
SetPlayerPos(playerid, -25.7220, -187.8216, 1003.5469);//Shop2
SetPlayerInterior(playerid, 17);
}
return 1;
}
CMD:exit(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, 246.6695, 65.8039, 1003.6406))
{
SetPlayerPos(playerid, 1553.779052, -1675.300048, 16.195312);//PD
SetPlayerInterior(playerid, 0);
}
if(IsPlayerInRangeOfPoint(playerid, 3.0, -25.7220, -187.8216, 1003.5469))
{
SetPlayerPos(playerid, 1929.604980, -1776.355957, 13.546875);//Shop1
SetPlayerInterior(playerid, 0);
}
if(IsPlayerInRangeOfPoint(playerid, 3.0, -25.7220, -187.8216, 1003.5469))
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 2423.711181, -1742.248657, 13.546875);//Shop2
}
return 1;
}
Is there anyway. I can make it so, it remeber the players last position?
Thanks for the help
Re: Need your help -
BiosMarcel - 16.05.2016
PHP код:
new Float:lastPos[3];
CMD:enter(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, 1553.779052, -1675.300048, 16.195312))
{
GetPlayerPos(playerid, lastPos[0], lastPos[1], lastPos[2]);
SetPlayerPos(playerid, 246.6695, 65.8039, 1003.6406);//PD
SetPlayerInterior(playerid, 6);
}
else if(IsPlayerInRangeOfPoint(playerid, 3.0, 1929.604980, -1776.355957, 13.546875))
{
GetPlayerPos(playerid, lastPos[0], lastPos[1], lastPos[2]);
SetPlayerPos(playerid, -25.7220, -187.8216, 1003.5469);//Shop1
SetPlayerInterior(playerid, 17);
}
else if(IsPlayerInRangeOfPoint(playerid, 3.0, 2423.711181, -1742.248657, 13.546875))
{
GetPlayerPos(playerid, lastPos[0], lastPos[1], lastPos[2]);
SetPlayerPos(playerid, -25.7220, -187.8216, 1003.5469);//Shop2
SetPlayerInterior(playerid, 17);
}
return 1;
}
CMD:exit(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, 246.6695, 65.8039, 1003.6406))
{
GetPlayerPos(playerid, lastPos[0], lastPos[1], lastPos[2]);
SetPlayerPos(playerid, 1553.779052, -1675.300048, 16.195312);//PD
SetPlayerInterior(playerid, 0);
}
else if(IsPlayerInRangeOfPoint(playerid, 3.0, -25.7220, -187.8216, 1003.5469))
{
GetPlayerPos(playerid, lastPos[0], lastPos[1], lastPos[2]);
SetPlayerPos(playerid, 1929.604980, -1776.355957, 13.546875);//Shop1
SetPlayerInterior(playerid, 0);
}
else if(IsPlayerInRangeOfPoint(playerid, 3.0, -25.7220, -187.8216, 1003.5469))
{
GetPlayerPos(playerid, lastPos[0], lastPos[1], lastPos[2]);
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 2423.711181, -1742.248657, 13.546875);//Shop2
}
return 1;
}
Re: Need your help -
canip - 16.05.2016
Hi, i try'ed it. Still the same. When i exit Shop1. I'll spawn outside Shop2
But thanks for your reply
Re: Need your help -
BiosMarcel - 16.05.2016
Thats pretty weird, sure that the mistake doesn't lie somehwere else? maybe in this
PHP код:
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
i didnt change the cords just showed u how to get last player pos , changed the 2 last if to else if
Re: Need your help -
Sew_Sumi - 16.05.2016
It's because you aren't tracking which shop the player is in when they are entering, yet using the same exit coords for the shops.
The gl_property FS will show an example of how to do this.
It uses
PHP код:
currentInt[playerid] = propId;
to track which property they are in once they are put in.
Re: Need your help -
canip - 16.05.2016

Can you show me a example?
Thanks for the help btw
Re: Need your help -
Sew_Sumi - 16.05.2016
If you look in the filterscripts folder, gl_property.pwn is the example.
The enter/exit commands, and the usage of the currentInt array.
I've changed your original code to suit this addition.
Код:
new currentInt[MAX_PLAYERS]; // Put this up top of your script.
CMD:enter(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, 1553.779052, -1675.300048, 16.195312))
{
SetPlayerPos(playerid, 246.6695, 65.8039, 1003.6406);//PD
SetPlayerInterior(playerid, 6);
currentInt[playerid]=1
}
if(IsPlayerInRangeOfPoint(playerid, 3.0, 1929.604980, -1776.355957, 13.546875))
{
SetPlayerPos(playerid, -25.7220, -187.8216, 1003.5469);//Shop1
SetPlayerInterior(playerid, 17);
currentInt[playerid]=2
}
if(IsPlayerInRangeOfPoint(playerid, 3.0, 2423.711181, -1742.248657, 13.546875))
{
SetPlayerPos(playerid, -25.7220, -187.8216, 1003.5469);//Shop2
SetPlayerInterior(playerid, 17);
currentInt[playerid]=3
}
return 1;
}
CMD:exit(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, 246.6695, 65.8039, 1003.6406)&¤tInt[playerid]==1)
{
SetPlayerPos(playerid, 1553.779052, -1675.300048, 16.195312);//PD
SetPlayerInterior(playerid, 0);
}
if(IsPlayerInRangeOfPoint(playerid, 3.0, -25.7220, -187.8216, 1003.5469)&¤tInt[playerid]==2)
{
SetPlayerPos(playerid, 1929.604980, -1776.355957, 13.546875);//Shop1
SetPlayerInterior(playerid, 0);
}
if(IsPlayerInRangeOfPoint(playerid, 3.0, -25.7220, -187.8216, 1003.5469)&¤tInt[playerid]==3)
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 2423.711181, -1742.248657, 13.546875);//Shop2
}
currentInt[playerid] = 0;
return 1;
}