11.05.2011, 16:17
1. All of the CP's is not showing
2. And i bet there is more mistakes here
3.
i made this code now.
2. And i bet there is more mistakes here
3.
Код:
garage.pwn(55) : warning 213: tag mismatch garage.pwn(57) : warning 213: tag mismatch garage.pwn(73) : warning 213: tag mismatch
pawn Код:
//Line 55:
DestroyDynamic3DTextLabel(GarageText[garageid]);
//Line 57:
GarageText[garageid] = CreateDynamic3DTextLabel(string, 0xFF0000FF, X, Y, Z, 20.0);
//Line 73:
GarageText[garageid] = CreateDynamic3DTextLabel(string, 0xFF0000FF, X, Y, Z, 20.0);
pawn Код:
#include <a_samp>
#include <zcmd>
#include <streamer>
#define MAX_GARAGES 50
enum GarageDetails
{
GarageOwner[24],
GarageName[60],
Password[128],
Float:GarageX,
Float:GarageY,
Float:GarageZ,
Owned,
Price
}
new GarageInfo[MAX_GARAGES][GarageDetails];
new GaragePickup[MAX_GARAGES];
new GarageText[MAX_GARAGES];
public OnFilterScriptInit()
{
CreateGarage(1, 40.9486, 42.1416, 2.6322, 0, 10);
CreateGarage(2, 28.1944, 46.9426, 3.1172, 0, 20);
CreateGarage(3, 34.9718, 54.4329, 3.1172, 0, 30);
CreateGarage(4, 43.9701, 49.8170, 2.2283, 0, 40);
CreateGarage(5, 59.2476, 53.1024, 1.0232, 0, 50);
CreateGarage(6, 68.1350, 47.8600, 0.6094, 0, 60);
return 1;
}
COMMAND:buygarage(playerid, params[])
{
new garage = IsPlayerCloseEnoughGarage(playerid);
if(!garage) return SendClientMessage(playerid, 0xFF0000FF, "There is no garage close to you");
else if(GarageInfo[garage][Owned] == 1) return SendClientMessage(playerid, 0xFF0000FF, "Someone already own this garage");
{
BuyGarage(playerid, garage);
SendClientMessage(playerid, 0xFFFFFFAA, "You bought the garage!");
}
return 1;
}
stock BuyGarage(playerid, garageid)
{
new playername[MAX_PLAYERS], string[200];
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerName(playerid, playername, sizeof(playername));
GarageInfo[garageid][GarageOwner] = strval(playername);
format(string, sizeof(string), "%s's Garage", playername);
GarageInfo[garageid][GarageName] = strval(string);
GarageInfo[garageid][Owned] = 1;
DestroyDynamic3DTextLabel(GarageText[garageid]);
format(string, sizeof(string), "Owner: %s \nGarage Name: %s's Garage \nGarageid: %d", playername, playername, garageid);
GarageText[garageid] = CreateDynamic3DTextLabel(string, 0xFF0000FF, X, Y, Z, 20.0);
}
stock CreateGarage(garageid, Float:X, Float:Y, Float:Z, owned, price)
{
new string[194];
GarageInfo[garageid][GarageOwner] = strval("For Sale");
GarageInfo[garageid][GarageName] = strval("No Name");
GarageInfo[garageid][Password] = 0;
GarageInfo[garageid][GarageX] = X;
GarageInfo[garageid][GarageY] = Y;
GarageInfo[garageid][GarageZ] = Z;
GarageInfo[garageid][Owned] = owned;
GarageInfo[garageid][Price] = price;
GaragePickup[garageid] = CreateDynamicCP(X, Y, Z, 2.0, -1, -1, -1, 500.0);
format(string, sizeof(string), "Owner: %s \nGarage Name: %s \nPrice: %d", GarageInfo[garageid][GarageOwner], GarageInfo[garageid][GarageName], GarageInfo[garageid][Price]);
GarageText[garageid] = CreateDynamic3DTextLabel(string, 0xFF0000FF, X, Y, Z, 20.0);
}
stock IsPlayerCloseEnoughGarage(playerid)
{
for(new g = 0; g < MAX_GARAGES; g++)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, GarageInfo[g][GarageX], GarageInfo[g][GarageY], GarageInfo[g][GarageZ])) return 1;
}
return 0;
}
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
for(new g = 0; g < MAX_GARAGES; g++)
{
if(checkpointid == GaragePickup[g])
{
new str[150];
if(GarageInfo[g][Owned] == 0)
{
format(str, sizeof(str), "%s \nPrice: %d", GarageInfo[g][GarageOwner], GarageInfo[g][Price]);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX , "Garage Info", str, "Buy", "Cancel");
}
else
{
format(str, sizeof(str), "Owner: %s \nGarage Name: %s \nPrice: %d", GarageInfo[g][GarageOwner], GarageInfo[g][GarageName], GarageInfo[g][Price]);
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_MSGBOX , "Garage Info", str, "Calcel", "Cancel");
}
}
}
return 1;
}