01.08.2011, 06:26
I get these errors.
Pawn code:
Код:
C:\Users\Jot\Desktop\SAMP Server\filterscripts\House.pwn(4) : error 017: undefined symbol "strtok" C:\Users\Jot\Desktop\SAMP Server\filterscripts\House.pwn(111) : error 021: symbol already defined: "Pname" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 2 Errors.
Код:
#include <a_samp> #include <dini> #pragma unused strtok #define MAX_HOUSES 200 public OnGameModeInit() { CreateHouse("TestHouse1", 1, 2317.130615, 692.398498, 11.460937, 266.857757, 305.001586, 999.148437, 2, 1); CreateHouse("TestHouse2", 1, 2346.872802, 692.999267, 11.460937, 266.857757, 305.001586, 999.148437, 2, 1); CreateHouse("TestHouse3", 1, 2396.482666, 691.487060, 11.453125, 2196.850341, -1204.343261, 1049.023437, 6, 1); CreateHouse("TestHouse4", 1, 2398.476074, 735.344665, 11.460937, 2196.850341, -1204.343261, 1049.023437, 6, 1); CreateHouse("TestHouse5", 1, 2368.863525, 733.627502, 11.460937, 2196.850341, -1204.343261, 1049.023437, 6, 1); CreateHouse("TestHouse6", 1, 2013.253906, 731.041870, 11.453125, 266.857757, 305.001586, 999.148437, 5, 1); CreateHouse("TestHouse7", 1, 2449.826660, 742.588806, 11.460937, 266.857757, 305.001586, 999.148437, 5, 1); CreateHouse("TestHouse8", 1, 2449.662353, 714.210693, 11.468292, 266.857757, 305.001586, 999.148437, 5, 1); return 1; } enum houseinfo { HouseNames[60], //To save into the file HouseCost, //The house cost HouseOwner[24], // The house owners Name HouseIsBought, //If the house is brought or not Float:PickupX, // PickupX Float:PickupY, //PickupY Float:PickupZ, //PickupZ Float:TeleX, //The house location Float:TeleY, //The house location Float:TeleZ, //The house location Interior, //The house Interior HouseSell, //House sell price Owned, Virtual } new HouseInfo[MAX_HOUSES][houseinfo]; //It saves all the info in this variable. new HouseCount = -1; //House count new PickupID[MAX_HOUSES]; new InHouse[MAX_PLAYERS] = -1; stock CreateHouse(Filename[], Cost, Float:Pickupx, Float:Pickupy, Float:Pickupz, Float:Telex, Float:Teley, Float:Telez, interior, sell) { if(!dini_Exists("Owners.ini")) { dini_Create("Owners.ini"); } HouseCount ++; new ID = HouseCount; //HouseID format(HouseInfo[ID][HouseNames], 60, "%s", Filename); //Saves the HouseName into a variable HouseInfo[ID][HouseCost] = Cost; HouseInfo[ID][HouseIsBought] = 0; HouseInfo[ID][PickupX] = Pickupx; HouseInfo[ID][Virtual] = 2000000 + ID; HouseInfo[ID][PickupY] = Pickupy; HouseInfo[ID][PickupZ] = Pickupz; HouseInfo[ID][TeleX] = Telex; HouseInfo[ID][TeleY] = Teley; HouseInfo[ID][TeleZ] = Telez; HouseInfo[ID][Interior] = interior; HouseInfo[ID][HouseSell] = sell; if(strlen(dini_Get("Owners.ini", Filename))) //This is to see if there is any owner. { format(HouseInfo[ID][HouseOwner], 24, "%s", dini_Get("Owners.ini", Filename)); HouseInfo[ID][Owned] = 1; } PickupID[ID] = CreatePickup(1273, 23, Pickupx, Pickupy, Pickupz, -1); //Creates the pickup :). Create3DTextLabel("House", 0x00A0F6AA, Pickupx, Pickupy, Pickupz + 0.75, 15.0, 0, 1); } public OnPlayerPickUpPickup(playerid, pickupid) //Pickup callback { for(new J; J<MAX_HOUSES; J++) //Loops through all houses { if(pickupid == PickupID[J]) //If the pickupid is one of our house ones { new str[75]; if(HouseInfo[J][Owned] == 1) { format(str, sizeof(str), "~r~House Info~n~~g~Owner: ~w~%s", HouseInfo[J][HouseOwner]); } if(HouseInfo[J][Owned] == 0) { format(str, sizeof(str), "~r~House Info~n~~g~Owner: ~w~Nobody"); SendClientMessage(playerid, 0x67F6F6AA, "This house is up for sale! Type /buy to buy it"); } new str2[75]; format(str2, sizeof(str2), "~g~Cost price:%d ~w~%d~n~~g~Sell Price:~w~ %d", HouseInfo[J][HouseCost], HouseInfo[J][HouseSell]); new str3[150]; format(str3, sizeof(str3), "%s~n~%s", str, str2); GameTextForPlayer(playerid, str3, 3500, 3); } } return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/buy", cmdtext) == 0) { for(new i; i<MAX_HOUSES; i++) { if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][PickupX], HouseInfo[i][PickupY], HouseInfo[i][PickupZ])) { new Pname[24]; GetPlayerName(playerid, Pname, 24); if(strlen(dini_Get("Owned.ini", Pname))) if(GetPlayerMoney(playerid) < HouseInfo[i][HouseCost]) return SendClientMessage(playerid, 0xF60000AA, "You don't have enough money to buy this house"); if(HouseInfo[i][Owned] == 1) return SendClientMessage(playerid, 0xF60000AA, "This house is already owned!"); GivePlayerMoney(playerid, - HouseInfo[i][HouseCost]); GameTextForPlayer(playerid, "~r~House Purchased!", 2000, 3); HouseInfo[i][Owned] = 1; new Pname[24]; GetPlayerName(playerid, Pname, 24); format(HouseInfo[i][HouseOwner], 24, "%s", Pname); dini_Set("Owners.ini", Pname, HouseInfo[i][HouseNames]); return 1; } SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house"); return 1; } return 1; } if (strcmp("/sell", cmdtext) == 0) { for(new i; i<MAX_HOUSES; i++) { if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][PickupX], HouseInfo[i][PickupY], HouseInfo[i][PickupZ])) { new Pname[24]; GetPlayerName(playerid, Pname, 24); if(strcmp(Pname, HouseInfo[i][HouseOwner]) != 0) return SendClientMessage(playerid, 0xF60000AA, "You don't own this house!"); GivePlayerMoney(playerid, HouseInfo[i][HouseSell]); GameTextForPlayer(playerid, "~r~House Sold!", 2000, 3); HouseInfo[i][Owned] = 0; HouseInfo[i][HouseOwner] = EOS; dini_Unset("Owners.ini", Pname); return 1; } SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house"); return 1; } return 1; } if (strcmp("/enter", cmdtext) == 0) { for(new i; i<MAX_HOUSES; i++) { if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][PickupX], HouseInfo[i][PickupY], HouseInfo[i][PickupZ])) { new Pname[24]; GetPlayerName(playerid, Pname, 24); if(strcmp(Pname, HouseInfo[i][HouseOwner]) != 0) return SendClientMessage(playerid, 0xF60000AA, "You don't own this house!"); SetPlayerPos(playerid, HouseInfo[i][TeleX], HouseInfo[i][TeleY], HouseInfo[i][TeleZ]); SetPlayerInterior(playerid, HouseInfo[i][Interior]); InHouse[playerid] = i; SetPlayerVirtualWorld(playerid, HouseInfo[i][Virtual]); SendClientMessage(playerid, 0x00C4F6AA, "You have entered your house"); return 1; } SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house"); return 1; } return 1; } if (strcmp("/exit", cmdtext) == 0) { if(InHouse[playerid] == -1) return SendClientMessage(playerid, 0xF60000AA, "You are not in a house"); SetPlayerPos(playerid, HouseInfo[InHouse[playerid]][PickupX], HouseInfo[InHouse[playerid]][PickupY], HouseInfo[InHouse[playerid]][PickupZ]); SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0); SendClientMessage(playerid, 0x00C4F6AA, "You have exited your house"); InHouse[playerid] = -1; return 1; } return 0; }