House command help -
Tommeh - 13.08.2014
I got this code to where if you type /house tommeh, the player would teleport to the player's house, but how can i get this code to where if i type /house tom, or /house tomm, or even /house t, it knows that somebody has a file with those letters and executes the command?
Код:
dcmd_house(playerid, params[])
{
#pragma unused params
new file[128];
new pname[32];
new Float:HouseX, Float:HouseY, Float:HouseZ;
if(sscanf(params, "s", pname)) return SendClientMessage(playerid, COLOR_ORANGE, "/house <Name>");
format(file, sizeof(file), "/xadmin/Users/%s.ini", pname);
if(!dini_Exists(file))return SendClientMessage(playerid, COLOR_RED,"That Player doesn't have a house");
HouseX = dini_Float(file, "HouseX");
HouseY = dini_Float(file, "HouseY");
HouseZ = dini_Float(file, "HouseZ");
SetPlayerPos(playerid,HouseX,HouseY,HouseZ);
return 1;
}
Re: House command help -
Tommeh - 13.08.2014
bump
Re: House command help -
MacT - 13.08.2014
Little correct for you. You need set up targetid withhiss/her name who houses you want teleport.
pawn Код:
dcmd_house(playerid, params[])
{
#pragma unused params
new file[128];
new giveplayerid, giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
if(sscanf(params,"u",giveplayerid)) return SendClientMessage(playerid, COLOR_RED,"/house playerid/name");
new Float:HouseX, Float:HouseY, Float:HouseZ;
if(sscanf(params, "s", pname)) return SendClientMessage(playerid, COLOR_ORANGE, "/house <Name>");
format(file, sizeof(file), "/xadmin/Users/%s.ini", pname);
if(!dini_Exists(file))return SendClientMessage(playerid, COLOR_RED,"That Player doesn't have a house");
HouseX = dini_Float(file, "HouseX");
HouseY = dini_Float(file, "HouseY");
HouseZ = dini_Float(file, "HouseZ");
SetPlayerPos(playerid,HouseX,HouseY,HouseZ);
return 1;
}
Re: House command help -
Tommeh - 13.08.2014
sorry, not sure if this right, i'm trying have it where the player can /house <name> without the actual player not being online..if that makes sense
ex)if i want to go kid cannon's house, i can just /house kidcannon or /house kid or something of that nature (without her actually being online)
Sorry if what you post is actually right, im a newbie at this
Re: House command help -
MacT - 13.08.2014
Dont worry, I accepct members options. Okay, np and if you dont get work, you can write here. Bu if you get its working, when good to know.
Re: House command help -
Tommeh - 13.08.2014
Код:
dcmd_house(playerid, params[])
{
#pragma unused params
new file[128];
new pname[32];
new giveplayerid, giveplayer[MAX_PLAYER_NAME];
new Float:HouseX, Float:HouseY, Float:HouseZ;
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
if(sscanf(params,"u",giveplayerid)) return SendClientMessage(playerid, COLOR_RED,"/house playerid/name");
if(sscanf(params, "s", pname)) return SendClientMessage(playerid, COLOR_ORANGE, "/house <Name>");
format(file, sizeof(file), "/xadmin/Users/%s.ini", giveplayer);
if(!dini_Exists(file))return SendClientMessage(playerid, COLOR_RED,"That Player doesn't have a house");
HouseX = dini_Float(file, "HouseX");
HouseY = dini_Float(file, "HouseY");
HouseZ = dini_Float(file, "HouseZ");
SetPlayerPos(playerid,HouseX,HouseY,HouseZ);
return 1;
}
}
I wasn't sure if the sendername string was doing anything, but after editing this code a little, (i know i probably did this wrong), whenever i do /house <anything>, it spawns me at my house everytime. I can even do /house 429420 and it spawns me at my house.
Re: House command help -
Don_Cage - 13.08.2014
setplayerpos, change playerid to giveplayerid
Re: House command help -
Tommeh - 13.08.2014
didn't work....I don't want it where if someone does /house id, it will teleport them to their house. I only want it by name. And it's only working for my house. I have other accounts that have house files also and i want to be able to teleport to their house as well
Код:
dcmd_house(playerid, params[])
{
#pragma unused params
new file[128];
new pname[32];
new giveplayerid, giveplayer[MAX_PLAYER_NAME];
new Float:HouseX, Float:HouseY, Float:HouseZ;
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
if(sscanf(params,"u",giveplayerid)) return SendClientMessage(playerid, COLOR_RED,"/house playerid/name");
if(sscanf(params, "s", pname)) return SendClientMessage(playerid, COLOR_ORANGE, "/house <Name>");
format(file, sizeof(file), "/xadmin/Users/%s.ini", giveplayer);
if(!dini_Exists(file))return SendClientMessage(playerid, COLOR_RED,"That Player doesn't have a house");
HouseX = dini_Float(file, "HouseX");
HouseY = dini_Float(file, "HouseY");
HouseZ = dini_Float(file, "HouseZ");
SetPlayerPos(giveplayerid,HouseX,HouseY,HouseZ);
return 1;
}