09.07.2009, 17:45
Hi, i tried create property system, but it doesnt work... P.S. sorry I'm bad in english...
this is my code:
OnGameModeInit
OnPlayerEnterCheckpoint
Who can help to me?
this is my code:
Код:
//============================================================================== #define MAX_PROPERTIES 200 enum PropInfo { Owner[MAX_PLAYER_NAME], Name, Value, Earning, Checkpoint, IsBought } new propInfo[PropInfo][MAX_PROPERTIES]; new PlayerProperties[MAX_PLAYERS]; new EarningForPlayer[MAX_PLAYERS]; forward ServerioProperties(playerid); //==============================================================================
Код:
propInfo[Checkpoint][0] = CreateCheckpoint(2024.56,1007.65,10.81,0,5.0,45,true); propInfo[Value][0] = 200000; propInfo[Earning][0]= 20000; format(propInfo[Name][0],56,"Four Dragons Casino"); propInfo[Checkpoint][1] = CreateCheckpoint(2182.12,1115.15,12.35,0,5.0,45,true); propInfo[Value][1] = 120000; propInfo[Earning][1]= 1200; format(propInfo[Name][1],56,"Come A Lot"); propInfo[Checkpoint][2] = CreateCheckpoint(2208.27,1286.29,10.81,0,5.0,45,true); propInfo[Value][2] = 130000; propInfo[Earning][2]= 1300; format(propInfo[Name][2],56,"Camels Toe"); propInfo[Checkpoint][3] = CreateCheckpoint(1956.68,1342.80,15.35,0,5.0,45,true); propInfo[Value][3] = 13000; propInfo[Earning][3]= 130; format(propInfo[Name][3],56,"The High Roller"); propInfo[Checkpoint][4] = CreateCheckpoint(2088.62,1449.17,10.52,0,5.0,45,true); propInfo[Value][4] = 150000; propInfo[Earning][4]= 15000; format(propInfo[Name][4],56,"Royal Casino");
Код:
new string[128]; for(new propid; propid<MAX_PROPERTIES; propid++) { if(GetPlayerCheckpoint(playerid) == propInfo[Checkpoint][propid]) { if(propInfo[IsBought][propid] == 0) { format(string, sizeof(string), "PROPERTY: Sio busto pavadinimas %s!", propInfo[Name][propid]); SendClientMessage(playerid, COLOR_WHITE, string); format(string, sizeof(string), "PROPERTY: Sio busto kaina %d!", propInfo[Value][propid]); SendClientMessage(playerid, COLOR_WHITE, string); format(string, sizeof(string), "PROPERTY: Sio busto uzdarbis %d!", propInfo[Earning][propid]); SendClientMessage(playerid, COLOR_WHITE, string); } else { format(string, sizeof(string), "PROPERTY: Sis bustas nupirktas. Savininkas %s!", propInfo[Owner][propid]); SendClientMessage(playerid, COLOR_WHITE, string); } } } return 1; }