CreateHouse Command
#1

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(playeridparams[])
{
    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
Reply
#2

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
Reply
#3

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;
}
Reply
#4

any help
Reply
#5

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 ?
Reply
#6

Yes Easy but i got many errors XD

PHP код:
C:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : error 001expected token"-string end-"but found "-identifier-"
C:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : warning 215expression has no effect
C
:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : warning 215expression has no effect
C
:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : error 001expected token";"but found ")"
C:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : error 029invalid expressionassumed zero
C
:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : fatal error 107too 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;
}
Reply
#7

Yes Easy but i got many errors XD

PHP код:
C:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : error 001expected token"-string end-"but found "-identifier-"
C:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : warning 215expression has no effect
C
:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : warning 215expression has no effect
C
:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : error 001expected token";"but found ")"
C:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : error 029invalid expressionassumed zero
C
:\Users\RedRex\Desktop\LVCNR\filterscripts\H-ouse.pwn(205) : fatal error 107too 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;
}
Reply
#8

PHP код:
if(sscanf(params,"ii"tmp,tmp2)) 
You lack a comma before tmp
Reply
#9

EDITED:- Worked but let me try it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)