06.08.2017, 17:02
So I have a /hspawn , /hgoto /dshouse command it all does the magic near his house entrance but it would be much better if i could set him to spawn inside the house interior and also teleport to an interior also set his virtualworld if somebody could help me with this im glad to rep you
PHP код:
public OnPlayerSpawn(playerid)
{
new spawn[256], pname[24], Float:NewX, Float:NewY, Float:NewZ;
GetPlayerName(playerid, pname, sizeof(pname));
format(spawn, sizeof(spawn), FILE_NAME, udb_encode(pname));
if(dini_Exists(spawn) == 1)
{
NewX = dini_Float(spawn, "X");
NewY = dini_Float(spawn, "Y");
NewZ = dini_Float(spawn, "Z");
SetPlayerPos(playerid, NewX, NewY, NewZ);
SendClientMessage(playerid, 0x0000CDAA,"House spawn loaded...");
}
else
{
SendClientMessage(playerid, 0x0000CDAA, "No shouse spawn loaded, Your can save one with /hspawn");
}
return 1;
}
COMMAND:hspawn (playerid, params[])
{
new make[256], pname[24], Float:LastX, Float:LastY, Float:LastZ;
GetPlayerName(playerid, pname, sizeof(pname));
format(make, sizeof(make), FILE_NAME, udb_encode(pname));
dini_Create(make);
GetPlayerPos(playerid, LastX, LastY, LastZ);
dini_FloatSet(make, "X", LastX);
dini_FloatSet(make, "Y", LastY);
dini_FloatSet(make, "Z", LastZ);
SendClientMessage(playerid, 0x0000CDAA,"House spawn is set!");
return 1;
}
COMMAND:ghouse (playerid, params[])
{
new str1[256], pname[24];
GetPlayerName(playerid, pname, sizeof(pname));
format(str1, sizeof(str1), FILE_NAME, udb_encode(pname));
if (dini_Exists(str1))
{
new Float:GotoX, Float:GotoY, Float:GotoZ;
GotoX = dini_Float(str1, "X");
GotoY = dini_Float(str1, "Y");
GotoZ = dini_Float(str1, "Z");
SetPlayerPos(playerid,GotoX,GotoY,GotoZ);
SendClientMessage(playerid, 0x0000CDAA,"Your teleported to your House!");
}
else
{
SendClientMessage(playerid, 0x0000CDAA,"ERROR:File not found");
}
return 1;
}
COMMAND:dshouse (playerid, params[])
{
new str1[256], pname[24];
GetPlayerName(playerid, pname, sizeof(pname));
format(str1, sizeof(str1), FILE_NAME, udb_encode(pname));
if (dini_Exists(str1))
{
dini_Remove(str1);
SendClientMessage(playerid, 0x0000CDAA, "House spawn removed!");
}
else
{
SendClientMessage(playerid, 0x0000CDAA,"ERROR:House spawn doesn't exist!");
}
return 1;
}