CreateHouse Command -
Man43 - 22.04.2017
Hello, im using ZeroHouse system but after i did /chouse 500000 3 given me like this
Use: /chouse price intid and im already type the Price + Int id so wat's wrong here.
PHP код:
new Index;
CMD:chouse(playerid, params[])
{
new tmp[256];
tmp = strtok(params,Index);
new tmp2[256];
tmp2 = strtok(params,Index);
if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid,-1,"Use: /chouse [price] [intid]");
new id = strval(tmp2);
new Price = strval(tmp);
if(Price <= 0)
return SendClientMessage(playerid,-1,"Invalid house price. The house price must be between $"#MIN_HOUSE_PRICE" and $"#MAX_HOUSE_PRICE"");
CreateHouse(playerid,GetFreeHouseID(),Price,id);
SendClientMessage(playerid,-1,"House Created");
return 1;
}
EDITED: Here the #defines
Код HTML:
#define MAX_HOUSES 10000
#define MAX_INTERIORS 10
#define MAX_DIST 10
#define MAX_HOUSE_OWNED 2
#define MIN_HOUSE_PRICE 500000
#define MAX_HOUSE_PRICE 50000000
Re: CreateHouse Command -
khRamin78 - 23.04.2017
as i know your problem is here
PHP код:
new tmp[256];
tmp = strtok(params,Index);
new tmp2[256];
tmp2 = strtok(params,Index);
just use sscanf its best
PHP код:
if(sscanf(params,"ii",tmp,tmp2)) return SendClientMessage(bla bla bla);
and use your tmp tmp2 in order
and this is rude ! you are not checking right thing (just telling to know that)
PHP код:
if(Price <= 0)
// you have to change this to
if(Price < MIN_HOUSE_PRICE || Price > MAN_HOUSE_PRICE)
Re: CreateHouse Command -
Man43 - 23.04.2017
like this?
i got errors.
Код:
new Index;
CMD:chouse(playerid, params[])
{
if(sscanf(params,"ii",tmp,tmp2)) return SendClientMessage(playerid "bla bla bla");
new tmp[256];
tmp = strtok(params,Index);
new tmp2[256];
tmp2 = strtok(params,Index);
if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid,-1,"Use: /chouse [price] [intid]");
new id = strval(tmp2);
new Price = strval(tmp);
if(Price < MIN_HOUSE_PRICE || Price > MAN_HOUSE_PRICE)
return SendClientMessage(playerid,-1,"Invalid house price. The house price must be between $"#MIN_HOUSE_PRICE" and $"#MAX_HOUSE_PRICE"");
CreateHouse(playerid,GetFreeHouseID(),Price,id);
SendClientMessage(playerid,-1,"House Created");
return 1;
}
Re: CreateHouse Command -
Man43 - 23.04.2017
any help
Re: CreateHouse Command -
khRamin78 - 23.04.2017
PHP код:
CMD:chouse(playerid,params[])
{
new tmp,tmp2;
if(sscanf(params,"ii"tmp,tmp2)) return SendClientMessage(playerid,-1,"chouse <price> <indid>");
if(tmp < MIN_HOUSE_PRICE || tmp < MAX_HOUSE_PRICE) return SendClientMessage(playerid,-1,"price limit");
CreateHouse(playerid,GetFreeHouseID(),tmp,tmp2);
SendClientMessage(playerid,-1,"House Created");
return 1;
}
easy right ?
Re: CreateHouse Command -
Man43 - 23.04.2017
Yes Easy but i got many errors XD
PHP код:
C:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : warning 215: expression has no effect
C:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : warning 215: expression has no effect
C:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : error 001: expected token: ";", but found ")"
C:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : error 029: invalid expression, assumed zero
C:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : fatal error 107: too many error messages on one line
I Edited it to your code! and then i got this errors
[Sorry for my bad English]
Код:
new Index;
CMD:chouse(playerid,params[])
{
new tmp,tmp2;
if(sscanf(params,"ii"tmp,tmp2)) return SendClientMessage(playerid,-1,"chouse <price> <indid>");
if(tmp < MIN_HOUSE_PRICE || tmp < MAX_HOUSE_PRICE) return SendClientMessage(playerid,-1,"price limit");
CreateHouse(playerid,GetFreeHouseID(),tmp,tmp2);
SendClientMessage(playerid,-1,"House Created");
return 1;
}
Re: CreateHouse Command -
Man43 - 23.04.2017
Yes Easy but i got many errors XD
PHP код:
C:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : warning 215: expression has no effect
C:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : warning 215: expression has no effect
C:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : error 001: expected token: ";", but found ")"
C:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : error 029: invalid expression, assumed zero
C:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : fatal error 107: too many error messages on one line
I Edited it to your code! and then i got this errors
[Sorry for my bad English]
Код:
new Index;
CMD:chouse(playerid,params[])
{
new tmp,tmp2;
if(sscanf(params,"ii"tmp,tmp2)) return SendClientMessage(playerid,-1,"chouse <price> <indid>");
if(tmp < MIN_HOUSE_PRICE || tmp < MAX_HOUSE_PRICE) return SendClientMessage(playerid,-1,"price limit");
CreateHouse(playerid,GetFreeHouseID(),tmp,tmp2);
SendClientMessage(playerid,-1,"House Created");
return 1;
}
Re: CreateHouse Command -
Toroi - 23.04.2017
PHP код:
if(sscanf(params,"ii"tmp,tmp2))
You lack a comma before
tmp
Re: CreateHouse Command -
Man43 - 23.04.2017
EDITED:-
Worked but let me try it