CMD:createhouse(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You aren't an admin!");//Check if the player is currently rcon logged in.
new HousePrice,id = HouseCount;//Creating the house price for the selected value in the command, and the last house id created.
if(sscanf(params,"i",HousePrice)) return SendClientMessage(playerid,-1,"USAGE: /createhouse <price>");//Checking if the player uses the correct syntax. The parameter "i" in sscanf means integer, also could be used as "d".
new Float:x,Float:y,Float:z;//Creating the floats, to store the player's position.
GetPlayerPos(playerid,x,y,z);//Getting the player's position and storing it
HInfo[id][Price] = HousePrice;//Setting the house price to the selected one.
HInfo[id][Owned] = 0;//Setting the house id owned = 0
HInfo[id][XPos] = x;//Storing the XPos value to the player's x.
HInfo[id][YPos] = y;//Storing the YPos value to the player's y.
HInfo[id][ZPos] = z;//Storing the ZPos value to the player's z.
HInfo[id][VirtualWorld] = GetPlayerVirtualWorld(playerid);
format(HInfo[id][Owner],24,"Nonusablenameforthishouse");//Formating the "Owner" house id value to "Nonusablenameforthishouse".
SendClientMessage(playerid,-1,"House created");
HouseEnter[id] = CreateDynamicCP(x,y,z,1.5,GetPlayerVirtualWorld(playerid));//Creating the checkpoint and storing it in the HouseEnter value.
HouseExit[id] = CreateDynamicCP(443.9237,509.4609,1001.4195,1.5,GetPlayerVirtualWorld(playerid));//Creating the house exit checkpoint and storing it in the HouseExit value.
new file[40],labelstring[100];//Creating the "file", and the labelstring var.
format(file,sizeof(file),"FHouse/Houses/%i.ini",id);//Formating the var to the selected house directory.
INI_Open(file);//Opening the file with SII.
INI_WriteInt("Price",HousePrice);//Writing in the place "Price" the inputted "Price" value.
INI_WriteInt("Owned",0);//Setting to "Owned" = 0 in the ini file.
INI_WriteInt("VirtualWorld",GetPlayerVirtualWorld(playerid));//Writing "VirtualWorld" = GetPlayerVirtualWorld(..);
INI_WriteFloat("XPos",x);//Writing the players pos for the check point position.
INI_WriteFloat("YPos",y);//Self explanatory.
INI_WriteFloat("ZPos",z);//Self explanatory.
INI_WriteString("Owner","Nonusablenameforthishouse");//Writing a string in "Owned" to "Nonusablenameforthishouse"
INI_Save();//Saving file with SII.
INI_Close();//Closing the file with SII.
format(labelstring,sizeof(labelstring),"Owned: No \nPrice: %i",HousePrice);
HInfo[id][HouseLabel] = Create3DTextLabel(labelstring,0xFF0000FF,x,y,z,25.0,GetPlayerVirtualWorld(playerid));
HouseCount++;
return 1;
}
(1287) : error 035: argument type mismatch (argument 1) (1288) : error 035: argument type mismatch (argument 1) (1289) : error 035: argument type mismatch (argument 1) (1290) : error 035: argument type mismatch (argument 1) (1291) : error 035: argument type mismatch (argument 1) (1292) : error 035: argument type mismatch (argument 1) (1293) : error 035: argument type mismatch (argument 1)
INI_WriteInt("Price",HousePrice);//Writing in the place "Price" the inputted "Price" value.
INI_WriteInt("Owned",0);//Setting to "Owned" = 0 in the ini file.
INI_WriteInt("VirtualWorld",GetPlayerVirtualWorld(playerid));//Writing "VirtualWorld" = GetPlayerVirtualWorld(..);
INI_WriteFloat("XPos",x);//Writing the players pos for the check point position.
INI_WriteFloat("YPos",y);//Self explanatory.
INI_WriteFloat("ZPos",z);//Self explanatory.
INI_WriteString("Owner","Nonusablenameforthishouse");//Writing a string in "Owned" to "Nonusablenameforthishouse"
INI_WriteInt(File, "Price",HousePrice);//Writing in the place "Price" the inputted "Price" value.
INI_WriteInt(File, "Owned",0);//Setting to "Owned" = 0 in the ini file.
INI_WriteInt(File, "VirtualWorld",GetPlayerVirtualWorld(playerid));//Writing "VirtualWorld" = GetPlayerVirtualWorld(..);
INI_WriteFloat(File, "XPos",x);//Writing the players pos for the check point position.
INI_WriteFloat(File, "YPos",y);//Self explanatory.
INI_WriteFloat(File, "ZPos",z);//Self explanatory.
INI_WriteString(File, "Owner","Nonusablenameforthishouse");
pawn Код:
|
(1287) : error 017: undefined symbol "File" (1288) : error 017: undefined symbol "File" (1289) : error 017: undefined symbol "File" (1290) : error 017: undefined symbol "File" (1291) : error 017: undefined symbol "File" (1292) : error 017: undefined symbol "File" (1293) : error 017: undefined symbol "File" (1294) : error 017: undefined symbol "INI_Save"
CMD:createhouse(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You aren't an admin!");//Check if the player is currently rcon logged in.
new HousePrice,id = HouseCount;//Creating the house price for the selected value in the command, and the last house id created.
if(sscanf(params,"i",HousePrice)) return SendClientMessage(playerid,-1,"USAGE: /createhouse <price>");//Checking if the player uses the correct syntax. The parameter "i" in sscanf means integer, also could be used as "d".
new Float:x,Float:y,Float:z;//Creating the floats, to store the player's position.
GetPlayerPos(playerid,x,y,z);//Getting the player's position and storing it
HInfo[id][Price] = HousePrice;//Setting the house price to the selected one.
HInfo[id][Owned] = 0;//Setting the house id owned = 0
HInfo[id][XPos] = x;//Storing the XPos value to the player's x.
HInfo[id][YPos] = y;//Storing the YPos value to the player's y.
HInfo[id][ZPos] = z;//Storing the ZPos value to the player's z.
HInfo[id][VirtualWorld] = GetPlayerVirtualWorld(playerid);
format(HInfo[id][Owner],24,"Nonusablenameforthishouse");//Formating the "Owner" house id value to "Nonusablenameforthishouse".
SendClientMessage(playerid,-1,"House created");
HouseEnter[id] = CreateDynamicCP(x,y,z,1.5,GetPlayerVirtualWorld(playerid));//Creating the checkpoint and storing it in the HouseEnter value.
HouseExit[id] = CreateDynamicCP(443.9237,509.4609,1001.4195,1.5,GetPlayerVirtualWorld(playerid));//Creating the house exit checkpoint and storing it in the HouseExit value.
new labelstring[100];//Creating the "file", and the labelstring var.
new INI:file = INI_Open("FHouse/Houses/%i.ini",id););
INI_WriteInt(file,"Price",HousePrice);//Writing in the place "Price" the inputted "Price" value.
INI_WriteInt(file,"Owned",0);//Setting to "Owned" = 0 in the ini file.
INI_WriteInt(file,"VirtualWorld",GetPlayerVirtualWorld(playerid));//Writing "VirtualWorld" = GetPlayerVirtualWorld(..);
INI_WriteFloat(file,"XPos",x);//Writing the players pos for the check point position.
INI_WriteFloat(file,"YPos",y);//Self explanatory.
INI_WriteFloat(file,"ZPos",z);//Self explanatory.
INI_WriteString(file,"Owner","Nonusablenameforthishouse");//Writing a string in "Owned" to "Nonusablenameforthishouse"
INI_Save();//Saving file with SII.
INI_Close();//Closing the file with SII.
format(labelstring,sizeof(labelstring),"Owned: No \nPrice: %i",HousePrice);
HInfo[id][HouseLabel] = Create3DTextLabel(labelstring,0xFF0000FF,x,y,z,25.0,GetPlayerVirtualWorld(playerid));
HouseCount++;
return 1;
}
CMD:buy(playerid,params[])
{
for(new i = 0; i < MAX_HOUSES;i++)//Loop threw all houses.
{
if(!IsPlayerInRangeOfPoint(playerid,8.0,HInfo[i][XPos],HInfo[i][YPos],HInfo[i][ZPos])) continue;//Check if the player is near a house checkpoint
if(GetPlayerMoney(playerid) < HInfo[i][Price]) return SendClientMessage(playerid,-1,"You don't have enough money");//Checking the players money, to see if he has enough to buy the house.
if(HInfo[i][Owned] == 1) return SendClientMessage(playerid,-1,"This house is already owned");//Checking if the house is already owned.
HInfo[i][Owned] = 1;//Setting the house owned var to 1.
new file[60],pName[24],string[100];//Creating the necessary vars.
GetPlayerName(playerid,pName,sizeof(pName));//Retrieving the player's name.
format(HInfo[i][Owner],24,"%s",pName);//Setting the House Owner's var
format(file,sizeof(file),"FHouse/Houses/%i.ini",i);//Formating the house file
INI_Open(file);//Opening the house file
INI_WriteInt("Owned",1);//Setting in the ini file "Owned" to 1
INI_WriteString("Owner",pName);//Setting the "Owner" to the player's name.
//INI_Save();//Saving the ini
INI_Close();//Closing the ini
format(string,sizeof(string),"Owned: Yes \nPrice: %i \nOwner: %s",HInfo[i][Price],pName);//Formating the string, so we can update the label of the house
Update3DTextLabelText(HInfo[i][HouseLabel],0xFF0000FF,string);//Updating the label with a red color
return 1;
}
SendClientMessage(playerid,-1,"You aren't near a house!");
return 1;
}
(1316) : error 035: argument type mismatch (argument 1) (1317) : error 035: argument type mismatch (argument 1)
CMD:buy(playerid,params[])
{
for(new i = 0; i < MAX_HOUSES;i++)//Loop threw all houses.
{
if(!IsPlayerInRangeOfPoint(playerid,8.0,HInfo[i][XPos],HInfo[i][YPos],HInfo[i][ZPos])) continue;//Check if the player is near a house checkpoint
if(GetPlayerMoney(playerid) < HInfo[i][Price]) return SendClientMessage(playerid,-1,"You don't have enough money");//Checking the players money, to see if he has enough to buy the house.
if(HInfo[i][Owned] == 1) return SendClientMessage(playerid,-1,"This house is already owned");//Checking if the house is already owned.
HInfo[i][Owned] = 1;//Setting the house owned var to 1.
new file[60],pName[24],string[100];//Creating the necessary vars.
GetPlayerName(playerid,pName,sizeof(pName));//Retrieving the player's name.
format(HInfo[i][Owner],24,"%s",pName);//Setting the House Owner's var
new INI:file = INI_Open("FHouse/Houses/%i.ini",i);
INI_WriteInt(file,"Owned",1);//Setting in the ini file "Owned" to 1
INI_WriteString(file,"Owner",pName);//Setting the "Owner" to the player's name.
//INI_Save();//Saving the ini
INI_Close();//Closing the ini
format(string,sizeof(string),"Owned: Yes \nPrice: %i \nOwner: %s",HInfo[i][Price],pName);//Formating the string, so we can update the label of the house
Update3DTextLabelText(HInfo[i][HouseLabel],0xFF0000FF,string);//Updating the label with a red color
return 1;
}
SendClientMessage(playerid,-1,"You aren't near a house!");
return 1;
}