How will I get this name?
#1

I'd like to get the name of the person who offered the house, how would that work?

pawn Код:
format(invite, sizeof(invite), "%s is offering to sell you %s for $%d, type /accept house to buy.", GetNameEx(playerid), HouseName[HouseOwned[playerid]], price);
    SendClientMessage(giveplayerid, COLOUR_WHITE, invite);
From this:
pawn Код:
CMD:sellhouse(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    new string[128],price, giveplayerid, invite[128];
    if(sscanf(params, "ud", giveplayerid, price)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /sellhouse [playerid] [price]");
    if(!IsPlayerNearPlayer(playerid, giveplayerid, 5.0))return SendClientMessage(playerid, COLOUR_GREY, "You must be close to the player to sell your house.");
    if(HouseOwned[giveplayerid] >= 1) return SendClientMessage(playerid, COLOUR_GREY, "That person already own's a house.");
    if(HouseOwned[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You don't have a house to sell.");
   
    HPrice[giveplayerid] = price;
    HouseOffered[giveplayerid] = 1;
    HouseIDOffered[giveplayerid] = MySQL_GetValue(PlayerSQLID[playerid], "HouseOwned", "accounts");
   
    format(invite, sizeof(invite), "%s is offering to sell you %s for $%d, type /accept house to buy.", GetNameEx(playerid), HouseName[HouseOwned[playerid]], price);
    SendClientMessage(giveplayerid, COLOUR_WHITE, invite);
   
    format(string, sizeof(string), "You are offering to sell %s to %s for $%d", HouseName[HouseOwned[playerid]], GetNameEx(giveplayerid), HPrice[giveplayerid]);
    SendClientMessage(playerid, COLOUR_ORANGE, string);
   
    HouseOwned[playerid] = 0;
   
    if(HouseAccepted[giveplayerid] == 1)
    {
        new accepted[128];
        format(accepted, sizeof(accepted), "%s Has Purchased your house!", GetNameEx(giveplayerid));
        SendClientMessage(playerid, COLOUR_WHITE, accepted);
    }
    return 1;
}
Reply
#2

You code is using GetNameEx(); Function for getting the player name who is offering to sell the house.

I hope this is exactly what you want to know? Correct me if im wrong?
Reply
#3

GetNameEx(); actually looses the "_" in the name.
Reply
#4

pawn Код:
new string2[128];
GetPlayerName(playerid,string2,sizeof(string2));
format(invite, sizeof(invite), "%s is offering to sell you %s for $%d, type /accept house to buy.", string2, HouseName[HouseOwned[playerid]], price);
    SendClientMessage(giveplayerid, COLOUR_WHITE, invite);
pawn Код:
CMD:sellhouse(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    new string[128],price, giveplayerid, invite[128],string2[128];
    GetPlayerName(playerid,string2,sizeof(string2));
    if(sscanf(params, "ud", giveplayerid, price)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /sellhouse [playerid] [price]");
    if(!IsPlayerNearPlayer(playerid, giveplayerid, 5.0))return SendClientMessage(playerid, COLOUR_GREY, "You must be close to the player to sell your house.");
    if(HouseOwned[giveplayerid] >= 1) return SendClientMessage(playerid, COLOUR_GREY, "That person already own's a house.");
    if(HouseOwned[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You don't have a house to sell.");
   
    HPrice[giveplayerid] = price;
    HouseOffered[giveplayerid] = 1;
    HouseIDOffered[giveplayerid] = MySQL_GetValue(PlayerSQLID[playerid], "HouseOwned", "accounts");
   
    format(invite, sizeof(invite), "%s is offering to sell you %s for $%d, type /accept house to buy.", string2, HouseName[HouseOwned[playerid]], price);
    SendClientMessage(giveplayerid, COLOUR_WHITE, invite);
   
    format(string, sizeof(string), "You are offering to sell %s to %s for $%d", HouseName[HouseOwned[playerid]], string2, HPrice[giveplayerid]);
    SendClientMessage(playerid, COLOUR_ORANGE, string);
   
    HouseOwned[playerid] = 0;
   
    if(HouseAccepted[giveplayerid] == 1)
    {
        new accepted[128];
        format(accepted, sizeof(accepted), "%s Has Purchased your house!", string2);
        SendClientMessage(playerid, COLOUR_WHITE, accepted);
    }
    return 1;
}
I hope this help's correct me if this is what you want?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)