Question about /enter and /exit CMD's
#1

Hey again xD , i know I asked many questions before but this is the last but please someone Answer me ,


I Made the /Enter CMD and it's working , and i made the /EXIT CMD and it's working... But the problem is.. how can i put them in one FS.. When i do this is Give Errors , it's working when each CMD is in a FS.. So can someone show me how ? here are the Codes :

This is the /ENTER CMD :
Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT

#include <a_samp>
#include <streamer>

forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
CreateDynamicObject(14777, 1957.3830566406, -2112.9575195313, 1002.0874023438, 0, 0, 0);
CreateDynamicObject(14777, 2064.2744140625, -2084.7614746094, 1114.4053955078, 0, 0, 0);
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Blank Script");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	return 1;
}



public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
if(!strcmp("/Enter", cmdtext, true))
 {
    if(IsPlayerInRangeOfPoint(playerid,3,1333.5809326172,-1863.5708007813,14.039328575134))
    {
        SetPlayerInterior(playerid, 1);
        SetPlayerPos(playerid,2064.185546875,-2071.7348632813,1115.2646484375);
        CreatePickup(1239,2,1333.5863037109,-1864.8194580078,14.652570724487);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid, 3, 5000, 5000, 5000))
    {
        SetPlayerPos(playerid,2064.185546875,-2071.7348632813,1115.2646484375);
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid, 3, 6000, 6000, 6000))
    {
        // Do something here, etc etc
    }
}

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);
		//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
		if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
		{
			return 1;
		}
	}
	return 0;
}

And this is the /EXIT CMD :
Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT

#include <a_samp>

forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Blank Script");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	return 1;
}



public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
if(!strcmp("/Exit", cmdtext, true))
 {
    if(IsPlayerInRangeOfPoint(playerid,3,2064.185546875,-2071.7348632813,1115.2646484375))
    {
        SetPlayerInterior(playerid, 1);
        SetPlayerPos(playerid,1333.5809326172,-1863.5708007813,14.039328575134);
        CreatePickup(1239,2,1333.5863037109,-1864.8194580078,14.652570724487);
        return 1;
    }
    else if(IsPlayerInRangeOfPoint(playerid, 3, 5000, 5000, 5000))
    {
        SetPlayerPos(playerid,1333.5809326172,-1863.5708007813,14.039328575134);
        return 1;
    }
    else if(IsPlayerInRangeOfPoint(playerid, 3, 6000, 6000, 6000))
    {
        // Do something here, etc etc
    }
}
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);
		//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
		if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
		{
			return 1;
		}
	}
	return 0;
}
If Someone Show me in CODES how to put them Together it would be Great xD
Reply
#2

Why do you have PlayerToPoint() function if you don't even use it?

Delete it if you don't use it...

Anyways, here it is:
pawn Код:
#include <a_samp>
#include <streamer>

public OnFilterScriptInit()
{
    CreateDynamicObject(14777, 1957.3830566406, -2112.9575195313, 1002.0874023438, 0, 0, 0);
    CreateDynamicObject(14777, 2064.2744140625, -2084.7614746094, 1114.4053955078, 0, 0, 0);
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

main()
{
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/enter", cmdtext, true))
    {
        if(IsPlayerInRangeOfPoint(playerid,3,1333.5809326172,-1863.5708007813,14.039328575134))
        {
            SetPlayerInterior(playerid, 1);
            SetPlayerPos(playerid,2064.185546875,-2071.7348632813,1115.2646484375);
            CreatePickup(1239,2,1333.5863037109,-1864.8194580078,14.652570724487);
            return 1;
        }
        if(IsPlayerInRangeOfPoint(playerid, 3, 5000, 5000, 5000))
        {
            SetPlayerPos(playerid,2064.185546875,-2071.7348632813,1115.2646484375);
            return 1;
        }
        if(IsPlayerInRangeOfPoint(playerid, 3, 6000, 6000, 6000))
        {
            // Do something here, etc etc
        }
    }
    if(!strcmp("/exit", cmdtext, true))
    {
        if(IsPlayerInRangeOfPoint(playerid,3,2064.185546875,-2071.7348632813,1115.2646484375))
        {
            SetPlayerInterior(playerid, 1);
            SetPlayerPos(playerid,1333.5809326172,-1863.5708007813,14.039328575134);
            CreatePickup(1239,2,1333.5863037109,-1864.8194580078,14.652570724487);
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 3, 5000, 5000, 5000))
        {
            SetPlayerPos(playerid,1333.5809326172,-1863.5708007813,14.039328575134);
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 3, 6000, 6000, 6000))
        {
            // Do something here, etc etc
        }
    }
    return 1;
}

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);
        //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
    }
    return 0;
}
Reply
#3

Working Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)