08.09.2012, 19:55
I've been working with this one for half minutes but still failing. Here it is..
First I want to disable using go command if player is inside any GarHouse (GarHouse is a Filterscript)
Here is my go command
As you can see above I have already made a
to check if player is inside a Garhouse.
This is for the GarHouse...
There is a note written about GetPVarInt
To check if player is inside a Garhouse
Here you can see
If i'm not wrong it tell me that If I do /go to a player that is inside a GarHouse. It should say "Player is in a House" Right??
MY Problem is that when a Player 1 is inside a GarHouse and Player 2 use, /go Player 1 and it works it teleports Player 2 right beside Player 1 and that must be disabled! Coz I already get the Get and Set the pVars.
Anyone mind helping me?
Here's the Garhouse pastebin http://pastebin.com/RMbk1myC
I don't know if i'm setting it wrong or something..
First I want to disable using go command if player is inside any GarHouse (GarHouse is a Filterscript)
Here is my go command
pawn Код:
CMD:go(playerid, params[])
{
new ID;//creates a new something idk what we call it :P but it is defined later on or used in something this 1 is used in next line
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFFFFFFFF, "{FFFF00}Usage: /go [PlayerID/PartofName]");//checks if you have written something after /goto if no it sends error
if(!IsPlayerConnected(ID) || ID == playerid) return SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}This player is Offline or it is Yourself");
if(GetPVarInt(playerid, "Jailed") == 1) return GameTextForPlayer(playerid,"Player is Jailed",2000,3);
if(GetPVarInt(playerid, "IsInHouse") == 1) return GameTextForPlayer(playerid,"Player is in a House",2000,3);
new Float:x, Float:y, Float:z, name[MAX_PLAYER_NAME], str[64], i, vw; //creates new variables to store floats, strings and values
GetPlayerPos(ID, x, y, z);//gets the player id(which we have entered after /goto position and like saves them into x,y,z defined above as floats
i = GetPlayerInterior(ID);
vw = GetPlayerVirtualWorld(ID);
if(i) SetPlayerInterior(playerid, i);
if(vw) SetPlayerVirtualWorld(playerid, vw);
if(IsPlayerInAnyVehicle(playerid))
{
if(i)
{
LinkVehicleToInterior(GetPlayerVehicleID(playerid), i);
DestroyVehicle(GetPlayerVehicleID(playerid));
}
if(vw) SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), vw);
SetVehiclePos(GetPlayerVehicleID(playerid), x + 1, y + 1, z + 0.5);
}
else SetPlayerPos(playerid, x + 1, y + 1, z);
return 1;
}
Код:
if(GetPVarInt(playerid, "IsInHouse") == 1) return GameTextForPlayer(playerid,"Player is in a House",2000,3);
This is for the GarHouse...
There is a note written about GetPVarInt
Quote:
// - [Script] IsInHouse "char" array for increased speed (compared to checking if a player is in a house using GetPVarInt. However you can still access the IsInHouse PVar in other scripts using GetPVarInt). |
pawn Код:
//==============================================================================
// SetPlayerHouseInterior(playerid, house);
// This function is used to set the correct house interior for a player when he enters a house or buy a new house interior.
//==============================================================================
stock SetPlayerHouseInterior(playerid, houseid)
{
new _int = hInfo[houseid][HouseInterior];
SetPVarInt(playerid, "IsInHouse", 1), IsInHouse{playerid} = 1;
SetPlayerPosEx(playerid, hIntInfo[_int][IntSpawnX], hIntInfo[_int][IntSpawnY], hIntInfo[_int][IntSpawnZ], hIntInfo[_int][IntInterior], (houseid + 1000));
SetPlayerFacingAngle(playerid, hIntInfo[_int][IntSpawnAngle]);
}
Код:
SetPVarInt(playerid, "IsInHouse", 1), IsInHouse{playerid} = 1;
MY Problem is that when a Player 1 is inside a GarHouse and Player 2 use, /go Player 1 and it works it teleports Player 2 right beside Player 1 and that must be disabled! Coz I already get the Get and Set the pVars.
Anyone mind helping me?
Here's the Garhouse pastebin http://pastebin.com/RMbk1myC
I don't know if i'm setting it wrong or something..