COMMAND:enter(playerid,params[])
{
new str[70];
for(new h; h <= MAX_HOUSES;h++)
{
if(IsPlayerInDynamicCP(playerid,CPID[h]))
{
SetPVarInt(playerid,"cpfix",GetTickCount() + 5000);
SetPlayerPos(playerid,Hinfo[h][entposx],Hinfo[h][entposy],Hinfo[h][entposz]);
SetPlayerFacingAngle(playerid,Hinfo[h][enterang]);
SetCameraBehindPlayer(playerid);
SetPlayerVirtualWorld(playerid,Hinfo[h][world]);
SetPlayerInterior(playerid,Hinfo[h][interior]);
format(str,sizeof(str),"~g~Welcome To ~p~%s",Hinfo[h][housename]);
GameTextForPlayer(playerid,str,5000,3);
SetPVarInt(playerid,"isinhouse",1);
SetPVarInt(playerid,"cpcheck",1);
}
}
if(GetPVarInt(playerid,"cpcheck")==0)
{
return SendClientMessage(playerid,0xff0000FF,"You Are Not at a house");
}
DeletePVar(playerid,"cpcheck");
return 1;
}
COMMAND:exit(playerid,params[])
{
if(GetPVarInt(playerid,"isinhouse")==0)return SendClientMessage(playerid,0xff0000FF,"ERROR: You are not in a house");
for(new h; h <= MAX_HOUSES;h++)
{
if(IsPlayerInDynamicCP(playerid,CPID[h]))
{
SetPVarInt(playerid,"cpfix",GetTickCount() + 5000);//to stop enter/exit cps from showing text on enter/exit.
SetPlayerPos(playerid,Hinfo[h][cpx],Hinfo[h][cpy],Hinfo[h][cpz]);
SetPlayerFacingAngle(playerid,Hinfo[h][exitang]);
SetCameraBehindPlayer(playerid);
SetPlayerVirtualWorld(playerid,0);
SetPlayerInterior(playerid,0);
DeletePVar(playerid,"isinhouse");
}
}
return 1;
}
if(IsPlayerInDynamicCP(playerid,CPID[h]))
{
SetPVarInt(playerid,"cpfix",GetTickCount() + 5000);
SetPlayerPos(playerid,Hinfo[h][entposx],Hinfo[h][entposy],Hinfo[h][entposz]);
SetPlayerFacingAngle(playerid,Hinfo[h][enterang]);
SetCameraBehindPlayer(playerid);
SetPlayerVirtualWorld(playerid,Hinfo[h][world]);
SetPlayerInterior(playerid,Hinfo[h][interior]);
format(str,sizeof(str),"~g~Welcome To ~p~%s",Hinfo[h][housename]);
GameTextForPlayer(playerid,str,5000,3);
SetPVarInt(playerid,"isinhouse",1);
SetPVarInt(playerid,"cpcheck",1);
}
else SendClientMessage(playerid, RED,"You are not near the house");
new h = -1;
for(h; h < MAX_HOUSES; h++)
{
if(IsPlayerInDynamicCP(playerid,CPID[h])) break;
}
if(h == -1) return SendClientMessage(playerid, -1, "You're not near a house!");
else
{
//Code if he is in a CP
}
for(h; h <= MAX_HOUSES; h++)
I'll give it a try but i don't think it will work because the actual command is returning "unknown command" ater its entered for the first time.
I dont think it has anything to do with ids or looping. will edit this post if it works (fingers cossed). EDIT: warning- expession has no effect. On this line, pawn Код:
|
new h = -1;
for(new H; H < MAX_HOUSES; H++)
{
if(IsPlayerInDynamicCP(playerid,CPID[H]))
{
h = H;
break;
}
}
if(h == -1) return SendClientMessage(playerid, -1, "You're not near a house!");
else
{
//Code if he is in a CP
}