Problem with CMD command
#1

Problem with house system:
Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
CMD:makehouse(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,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(pl ayerid));//Creating the checkpoint and storing it in the HouseEnter value.
HouseExit[id] = CreateDynamicCP(443.9237,509.4609,1001.4195,1.5,Ge tPlayerVirtualWorld(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;
}

Pawn error:
Quote:

C:\Users\Mario\Downloads\GL HF\gamemodes\rp1.pwn(101) : error 029: invalid expression, assumed zero
C:\Users\Mario\Downloads\GL HF\gamemodes\rp1.pwn(101) : error 017: undefined symbol "cmd_makehouse"
C:\Users\Mario\Downloads\GL HF\gamemodes\rp1.pwn(101) : error 029: invalid expression, assumed zero
C:\Users\Mario\Downloads\GL HF\gamemodes\rp1.pwn(101) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

Thanks
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    return 1;
}
pawn Код:
CMD:makehouse(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,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(pl ayerid));//Creating the checkpoint and storing it in the HouseEnter value.
    HouseExit[id] = CreateDynamicCP(443.9237,509.4609,1001.4195,1.5,Ge tPlayerVirtualWorld(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;
}
Custom command scripts are most likely not to place inside OnPlayerCommandText()
Reply
#3

lol i think you are confused with strcmp and dcmd XD
with zcmd you have to create the CMD out of arrays, so on bottom of script or between some but not in a array
and with zcmd you have to use CMD:youcmd, not CMD_yourcmd XD
anyways copy the thing what drebin posted here XD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)