Guest User

STRCMP u ZCMD Molim vass :'(

a guest
Sep 22nd, 2013
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. if(!strcmp(cmdtext, "/buyhouse", true))
  2. {
  3. new pName[MAX_PLAYER_NAME]; //For the player's name - For the house
  4. GetPlayerName(playerid, pName, MAX_PLAYER_NAME); //Get the name of the player and store it in [u]pName[/u]
  5. for(new i = 0; i < MAX_HOUSES; i++) //Last time I'm gonna say it: Loop through all the houses
  6. {
  7. if(IsPlayerInRangeOfPoint(playerid, 1.5, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]) && GetPlayerInterior(playerid) == HouseInfo[i][hOutsideInt] && GetPlayerVirtualWorld(playerid) == HouseInfo[i][hOutsideVir]) //Is player near house entrance, and if player is in interior of that house + virtual world (Last time I said this too!)
  8. {
  9. if(HouseInfo[i][hOwned]) return SendClientMessage(playerid, COLOR_RED, "This house is already owned!"); //Is the house owned? Then send message that it's owned and stop.
  10. if(GetPlayerMoney(playerid) < HouseInfo[i][hPrice]) return SendClientMessage(playerid, COLOR_RED, "You don't have enough money for this!"); //Has player too less money? Send him a message!
  11.  
  12. HouseInfo[i][hOwned] = true; //The house is owned, where the player used /buyhouse
  13. strmid(HouseInfo[i][hOwner], pName, 0, false, strlen(pName)); //Put the players name into the "hOwner" of the house
  14. GivePlayerMoney(playerid, -HouseInfo[i][hPrice]); //Remove some money of the player.. The value of the house
  15. SendClientMessage(playerid, COLOR_GREEN, "House bought!"); //Send the player an message.
  16. SaveHouse(i);
  17. LoadHouseVisual(i, true); //Load House Visual. Now, I've added ', true': It will RELOAD now!
  18. return 1;
  19. }
  20. }
  21. return 1;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment