[Ajuda] Comandos da Casa... -
Tipo galera eai..
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/vendercasa", true))
{
new pName[MAX_PLAYER_NAME]; //See /buyhouse
GetPlayerName(playerid, pName, MAX_PLAYER_NAME); //See new pName[MAX_PLAYER_NAME];
for(new i = 0; i < MAX_HOUSES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 1.5, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]) && GetPlayerInterior(playerid) == HouseInfo[i][hOutsideInt] && GetPlayerVirtualWorld(playerid) == HouseInfo[i][hOutsideVir])
{
if(!strcmp(HouseInfo[i][hOwner], pName, false)) //Is the owner of the house the same as the players name (is the player the owner?? !)
{
strmid(HouseInfo[i][hOwner], "For Sale", 0, false, 8); //Set the owner of the house to "For Sale"
HouseInfo[i][hOwned] = false; //House is not owner anymore!
GivePlayerMoney(playerid, HouseInfo[i][hPrice]/2); //Give the player 50% of the house value back!
SendClientMessage(playerid, COLOR_GREEN, "House sold!");
SaveHouse(i);
LoadHouseVisual(i, true); //Load House Visual. Now, I've added ', true': It will RELOAD now!
return 1;
}
}
}
return 1;
}
if(!strcmp(cmdtext, "/carrocasa", true))
{
new pName[MAX_PLAYER_NAME], Float:X, Float:Y, Float:Z;
new houseid = cmdtext[10]; //The param. /tphousecar is 0-8. With a space, 9. Then, the param is at 10.
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
if(!strcmp(HouseInfo[houseid][hOwner], pName, false)) return SendclientMessage(playerid, COLOR_RED, "You are not the owner of the house!");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You must be in an vehicle!"); //if is player not in an vehicle, send an message and stop (RETURN [message])
GetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z);
GetVehicleZAngle(GetPlayerVehicleID(playerid), A);
HouseInfo[houseid][hVecX] = X;
HouseInfo[houseid][hVecY] = Y;
HouseInfo[houseid][hVecZ] = Z;
HouseInfo[houseid][hVecA] = A;
return 1;
}
if(!strcmp(cmdtext, "/vendercasa", true))
{
new pName[MAX_PLAYER_NAME]; //For the player's name - For the house
GetPlayerName(playerid, pName, MAX_PLAYER_NAME); //Get the name of the player and store it in pName
for(new i = 0; i < MAX_HOUSES; i++) //Last time I'm gonna say it: Loop through all the houses
{
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!)
{
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.
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!
HouseInfo[i][hOwned] = true; //The house is owned, where the player used /buyhouse
strmid(HouseInfo[i][hOwner], pName, 0, false, strlen(pName)); //Put the players name into the "hOwner" of the house
GivePlayerMoney(playerid, -HouseInfo[i][hPrice]); //Remove some money of the player.. The value of the house
SendClientMessage(playerid, COLOR_GREEN, "House bought!"); //Send the player an message.
SaveHouse(i);
LoadHouseVisual(i, true); //Load House Visual. Now, I've added ', true': It will RELOAD now!
return 1;
}
}
return 1;
}
return 0;
}
o GM Da Varios erros! sem esses comandos ele cpmpilam normal, entao alguem pode dizer oq tem de errado nos comandos?
Re: [Ajuda] Comandos da Casa... -
Re: [Ajuda] Comandos da Casa... -
Re: [Ajuda] Comandos da Casa... -