20.12.2009, 04:23
Essentially, im trying to just make a /makehouse command, so admins IG can make houses, so i dont ahve to do it myself typing shit in property.cfg
I have never worked with saving NEW strings in a scriptfile, and am encountering some problems.
here is the codes:
I personally believe it has something to do with public MakeHouse() IT all compiles fine, the /makehouse command SEEMS to work, ends up printing "House Created!", but nothing happens.
If you could helpp, that'd be great. Thanks.
I have never worked with saving NEW strings in a scriptfile, and am encountering some problems.
here is the codes:
Code:
public MakeHouse() { new File: file2; new coordsstring[256]; format(coordsstring, sizeof(coordsstring), "%f,%f,%f,%f,%f,%f,0,0,0,0,0,0,The State,%s,%d,0,0,0,0,0,0,0,0,0,0,0,0,0,%d,%d\n", NewHouseX, NewHouseY, NewHouseZ, NewHIntX, NewHIntY, NewHIntZ, NewHDesc, NewHCost, NewHSkin, NewHLevel, NewHWorld); file2 = fopen("property.cfg", io_write); fwrite(file2, coordsstring); fclose(file2); }
Code:
if(strcmp(cmd, "/makehouse", true) == 0) { if(IsPlayerConnected(playerid)) { if (PlayerInfo[playerid][pAdmin] >= 5) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makehouse [ExitX] [ExitY] [ExitZ] [Desc] [Price] [IntID] [Level] [VW]"); return 1; } new enterx; tmp = strtok(cmdtext, idx); enterx = strval(tmp); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makehouse [ExitX] [ExitY] [ExitZ] [Desc] [Price] [IntID] [Level] [VW]"); return 1; } new entery; tmp = strtok(cmdtext, idx); entery = strval(tmp); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makehouse [ExitX] [ExitY] [ExitZ] [Desc] [Price] [IntID] [Level] [VW]"); return 1; } new enterz; tmp = strtok(cmdtext, idx); entery = strval(tmp); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makehouse [ExitX] [ExitY] [ExitZ] [Desc] [Price] [IntID] [Level] [VW]"); return 1; } new hdesc; tmp = strtok(cmdtext, idx); hdesc = strval(tmp); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makehouse [ExitX] [ExitY] [ExitZ] [Desc] [Price] [IntID] [Level] [VW]"); return 1; } new hprice; tmp = strtok(cmdtext, idx); hprice = strval(tmp); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makehouse [ExitX] [ExitY] [ExitZ] [Desc] [Price] [IntID] [Level] [VW]"); return 1; } new hintid; tmp = strtok(cmdtext, idx); hintid = strval(tmp); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makehouse [ExitX] [ExitY] [ExitZ] [Desc] [Price] [IntID] [Level] [VW]"); return 1; } new hlevel; tmp = strtok(cmdtext, idx); hlevel = strval(tmp); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makehouse [ExitX] [ExitY] [ExitZ] [Desc] [Price] [IntID] [Level] [VW]"); return 1; } new hvw; tmp = strtok(cmdtext, idx); hvw = strval(tmp); new Float:x, Float:y, Float:z; GetPlayerPos(playerid,x,y,z); NewHouseX = x; NewHouseY = y; NewHouseZ = z; NewHIntX = enterx; NewHIntY = entery; NewHIntZ = enterz; NewHDesc = hdesc; NewHCost = hprice; NewHSkin = hintid; NewHLevel = hlevel; NewHWorld = hvw; MakeHouse(); OnPropUpdate(); LoadProperty(); CustomPickups(); SendClientMessage(playerid, COLOR_GRAD2, "House Created!"); } else { SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!"); } } return 1; }
If you could helpp, that'd be great. Thanks.