Everyone can enter - 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)
+--- Thread: Everyone can enter (
/showthread.php?tid=287876)
Everyone can enter -
Stefans94 - 05.10.2011
Hello all,
I used the house tutorial from [HiC]TheKiller,
but I tried to make a version with pickups, so allot of things are different,
now my problem is, i made an enter command, and it works but
the user shouldn't be able to enter the house if it isn't his/her house..
and i can enter a house that isn't mine so =s
please help me? =D
pawn Код:
CMD:enter(playerid, params)
{
for(new x; x < houseid; x++)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if(IsPlayerInRangeOfPoint(playerid, 7.0, House[x][EnterPos][0], House[x][EnterPos][1], House[x][EnterPos][2])) {
if(!strcmp(pname, House[x][owner][0])) {
SetPlayerPos(playerid, House[x][TelePos][0], House[x][TelePos][1], House[x][TelePos][2]);
SetPlayerInterior(playerid, House[x][interiors]);
SetPlayerVirtualWorld(playerid, 15500000 + x);
} else {
SendClientMessage(playerid, COLOR_RED, "This house is not yours!");
}
}
if(IsPlayerInRangeOfPoint(playerid, 7.0, House[x][TelePos][0], House[x][TelePos][1], House[x][TelePos][2])) {
SetPlayerPos(playerid, House[x][EnterPos][0], House[x][EnterPos][1], House[x][EnterPos][2]);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
return 1;
}
}
return 1;
}
Re: Everyone can enter -
Pharrel - 05.10.2011
idk your whole code but i gess that in the [owner] would not have [0]
pawn Код:
CMD:enter(playerid)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
for(new x; x < houseid; x++)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, House[x][EnterPos][0], House[x][EnterPos][1], House[x][EnterPos][2]))
{
if(!strcmp(pname, House[x][owner],false))
{
SetPlayerPos(playerid, House[x][TelePos][0], House[x][TelePos][1], House[x][TelePos][2]);
SetPlayerInterior(playerid, House[x][interiors]);
SetPlayerVirtualWorld(playerid, 15500000 + x);
}
else return SendClientMessage(playerid, COLOR_RED, "This house is not yours!");
}
if(IsPlayerInRangeOfPoint(playerid, 7.0, House[x][TelePos][0], House[x][TelePos][1], House[x][TelePos][2]))
{
SetPlayerPos(playerid, House[x][EnterPos][0], House[x][EnterPos][1], House[x][EnterPos][2]);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
return 1;
}
}
return 1;
}
try this