24.04.2014, 14:22
you havn't read this?
pawn Код:
entratacasa[id] = CreateDynamicCP(Posx,Posy,Posz,2.5,GetPlayerVirtualWorld(playerid), -1);
uscitacasa[id] = CreateDynamicCP(cinfo[id][uscitaX],cinfo[id][uscitaY],cinfo[id][uscitaZ],2.5,GetPlayerVirtualWorld(playerid),-1);
pawn Код:
public OnPlayerEnterDynamicCP(playerid,checkpointid)
{
for(new i = 0; i < MAX_CASE; i++)
{
if(checkpointid == entratacasa[i]) // if checkpointid is enterhouses checkpoints
{
new nome[24];
GetPlayerName(playerid,nome,sizeof(nome));
if(cinfo[i][acquisita] == 1 && strcmp(cinfo[i][proprietario],nome) == 0) //if the house is owned and owner is true..
{
SetPVarInt(playerid,"PlayersInteriorCase",GetPlayerInterior(playerid));//Storing, so later we can reset it back
SetPVarInt(playerid,"PlayerVirtualWorldCase",GetPlayerVirtualWorld(playerid));//Storing, so later we can reset it back
SetPlayerInterior(playerid,cinfo[i][interior]); //Set Player interior
SetPlayerPos(playerid,cinfo[i][uscitaX]+3,cinfo[i][uscitaY],cinfo[i][uscitaZ]); //set player pos to pos of exit. (inside interior)
SetPlayerVirtualWorld(playerid,cinfo[i][virtualworld]);
playerincasaid[playerid] = i; // This is the variable that should save the player pos in house i so that him when exit don't spawn in other places.. (but i think that doesn't works)..
}
if(cinfo[i][acquisita] == 1 && cinfo[i][chiusa] == 1 && strcmp(cinfo[i][proprietario],nome) != 0)
{
GameTextForPlayer(playerid,"House ~r~Closed!",2000,3);
}
if(cinfo[i][acquisita] == 1 && strcmp(cinfo[i][proprietario],nome) != 0 && cinfo[i][chiusa] == 0)
{
SetPVarInt(playerid,"PlayersInteriorCase",GetPlayerInterior(playerid));//Storing, so later we can reset it back
SetPVarInt(playerid,"PlayerVirtualWorldCase",GetPlayerVirtualWorld(playerid));//Storing, so later we can reset it back
SetPlayerInterior(playerid,cinfo[i][interior]);
SetPlayerPos(playerid,cinfo[i][uscitaX]+3,cinfo[i][uscitaY],cinfo[i][uscitaZ]);
SetPlayerVirtualWorld(playerid,cinfo[i][virtualworld]);
playerincasaid[playerid] = i; //same if the player isn't the really owner but the door is open.
}
if(cinfo[i][acquisita] == 0) // if isn't owned..
{
GameTextForPlayer(playerid,"~g~/bhouse for buy this~r~ House!",2000,3);
}
}
if(checkpointid == uscitacasa[i]) // this set the player outside the interior..
{
SetPlayerPos(playerid,cinfo[i][entrataX]+3,cinfo[i][entrataY],cinfo[i][entrataZ]);
SetPlayerInterior(playerid,GetPVarInt(playerid,"PlayerInteriorCase"));
SetPlayerVirtualWorld(playerid,GetPVarInt(playerid,"PlayerVirtualWorldCase"));
}
}