[HELP] /enter, /exit, /find -
Oi! - 18.12.2009
I made a /enter and /exit command for Darrens housing system because I couldn't find the original, but they keep leading to ID 0, For Example: ID 0 house invites you, you get there and type /enter and it works same with /exit. However, ID 1 house invites you, you get there and type /enter but it doesn't work. Same with the /exit with the /breakin command, everytime I type /exit and it isn't in ID 0's house it won't work.
ENTER
Код:
if(InvitedToHouse[playerid] == 1)
{
if(IsPlayerConnected(playerid))
{
new Float:housex = PlayerInfo[giveplayerid][pHouseX];
new Float:housey = PlayerInfo[giveplayerid][pHouseY];
new Float:housez = PlayerInfo[giveplayerid][pHouseZ];
new Float:houseintx = PlayerInfo[giveplayerid][pHouseIntX];
new Float:houseinty = PlayerInfo[giveplayerid][pHouseIntY];
new Float:houseintz = PlayerInfo[giveplayerid][pHouseIntZ];
new housevw = PlayerInfo[giveplayerid][pHouseVW];
new houseint = PlayerInfo[giveplayerid][pHouseInt];
new Float:px, Float:py, Float:pz;
GetPlayerPos(playerid,px,py,pz);
if(PlayerToPoint(3.0,playerid,housex,housey,housez))
{
SetPlayerPos(playerid,houseintx,houseinty,houseintz);
SetPlayerVirtualWorld(playerid,housevw);
SetPlayerInterior(playerid,houseint);
return 1;
}
}
}
EXIT
Код:
if(InvitedToHouse[playerid] == 1)
{
if(IsPlayerConnected(playerid))
{
new Float:housex = PlayerInfo[giveplayerid][pHouseX];
new Float:housey = PlayerInfo[giveplayerid][pHouseY];
new Float:housez = PlayerInfo[giveplayerid][pHouseZ];
new Float:houseintx = PlayerInfo[giveplayerid][pHouseIntX];
new Float:houseinty = PlayerInfo[giveplayerid][pHouseIntY];
new Float:houseintz = PlayerInfo[giveplayerid][pHouseIntZ];
new Float:px, Float:py, Float:pz;
GetPlayerPos(playerid,px,py,pz);
if (PlayerToPoint(2.0, playerid,houseintx,houseinty,houseintz))
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,housex,housey,housez);
SetPlayerVirtualWorld(playerid,0);
InvitedToHouse[playerid] = 0;
}
}
}
if(HouseBreakin[playerid] == 1)
{
if(IsPlayerConnected(playerid))
{
new Float:housex = PlayerInfo[giveplayerid][pHouseX];
new Float:housey = PlayerInfo[giveplayerid][pHouseY];
new Float:housez = PlayerInfo[giveplayerid][pHouseZ];
new Float:houseintx = PlayerInfo[giveplayerid][pHouseIntX];
new Float:houseinty = PlayerInfo[giveplayerid][pHouseIntY];
new Float:houseintz = PlayerInfo[giveplayerid][pHouseIntZ];
new Float:px, Float:py, Float:pz;
GetPlayerPos(playerid,px,py,pz);
if (PlayerToPoint(2.0, playerid,houseintx,houseinty,houseintz))
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,housex,housey,housez);
SetPlayerVirtualWorld(playerid,0);
HouseBreakin[playerid] = 0;
}
}
}
And this is what's wrong with /find, everytime I find someone and they aren't ID 0 their name won't go back to the Team Color, here's the code for that:
Код:
if(FindTime[i] > 0)
{
if(IsPlayerConnected(i))
{
if(FindTime[i] == FindTimePoints[i])
{
giveplayerid = ReturnUser(tmp);
FindTime[i] = 0;
FindTimePoints[i] = 0;
DisablePlayerCheckpoint(i);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
GameTextForPlayer(i, "~r~RedMarker gone", 2500, 1);
SetPlayerToTeamColor(giveplayerid);
}
else
{
format(string, sizeof(string), "%d", FindTimePoints[i] - FindTime[i]);
GameTextForPlayer(i, string, 1500, 6);
FindTime[i] += 1;
}
}
}
Re: [HELP] /enter, /exit, /find -
M4S7ERMIND - 18.12.2009
Explain how
giveplayerid got in /enter & /exit commands, then I can help..
Re: [HELP] /enter, /exit, /find -
Oi! - 18.12.2009
EDIT: Okay I got the /enter and /exit, can somebody just help me with the /find now?
Re: [HELP] /enter, /exit, /find -
dice7 - 18.12.2009
What he's trying to say is where do you actually assign "giveplayerid" a value
Re: [HELP] /enter, /exit, /find -
Oi! - 18.12.2009
Код:
if(strcmp(cmd, "/find", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] != 1)
{
SendClientMessage(playerid, COLOR_GREY, " You are not a mercenary !");
return 1;
}
if(UsedFind[playerid] != 0 && PlayerInfo[playerid][pDetSkill] < 401)
{
SendClientMessage(playerid, COLOR_GREY, " You've already searched for someone, please wait for your time to reload!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /find [playerid/PartOfName]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Find yourself!"); return 1; }
new points;
new level = PlayerInfo[playerid][pDetSkill];
if(level >= 0 && level <= 50)
{
points = 4;
}
else if(level >= 51 && level <= 100)
{
points = 6;
}
else if(level >= 101 && level <= 200)
{
points = 8;
}
else if(level >= 201 && level <= 400)
{
points = 10;
}
else if(level >= 401)
{
points = 12;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
SetPlayerMarkerForPlayer(playerid,giveplayerid,0xFF6347AA);
FindTime[playerid] = 1;
FindTimePoints[playerid] = points;
PlayerInfo[playerid][pDetSkill] ++;
UsedFind[playerid] = 1;
if(PlayerInfo[playerid][pDetSkill] == 50)
{ SendClientMessage(playerid, COLOR_YELLOW, "* Your Mercenary Skill is now Level 2, you now have more time to find people."); }
else if(PlayerInfo[playerid][pDetSkill] == 100)
{ SendClientMessage(playerid, COLOR_YELLOW, "* Your Mercenary Skill is now Level 3, you now have more time to find people."); }
else if(PlayerInfo[playerid][pDetSkill] == 200)
{ SendClientMessage(playerid, COLOR_YELLOW, "* Your Mercenary Skill is now Level 4, you now have more time to find people."); }
else if(PlayerInfo[playerid][pDetSkill] == 400)
{ SendClientMessage(playerid, COLOR_YELLOW, "* Your Mercenary Skill is now Level 5, you now have more time to find people."); }
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Invalid Name/ID !");
}
}
Код:
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
SetPlayerMarkerForPlayer(playerid,giveplayerid,0xFF6347AA);