SA-MP Forums Archive
Updating Names (+rep) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Updating Names (+rep) (/showthread.php?tid=325644)



Updating Names (+rep) - SnG.Scot_MisCuDI - 14.03.2012

solved.


Re: Updating Names (+rep) - TTJJ - 14.03.2012

Hi there,

May I ask what
pawn Код:
if(GetPlayerBusinessID(playerid) == 1)
That line is for?

Also, you have not formatted the business info "bLabel" variable. Try adding this to your code:

pawn Код:
format(BusinessInfo[cpid[playerid]][bLabel],128,"%s",name);
Change the 128 integer to be the length of your bLabel variable.

Cheers,

TJ


Re: Updating Names (+rep) - Tanush123 - 14.03.2012

You mean changing a business name?
Idk where you got getplayerbusinessid from Tee Dynamic Bus well use this
pawn Код:
COMMAND:namebiz(playerid, params[])
{
    new name[128],busid;
    if(sscanf(params,"is",busid,name))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /bizname [name]");
    format(file,sizeof(file),"Business/%i.ini",busid);
    dini_Set(file, "Name", name);
    format(String,sizeof(String),"Biz renamed to: %s",name);
    SendClientMessage(playerid,Green,String);
    format(Label, sizeof(Label), "Business Name: %s\nOwner: No Owner\nCost: $%i\nPayout: $%i", name,dini_Int(file,"Cost"),dini_Int(file,"Payout"));
    Update3DTextLabelText(BusinessInfo[busid][bLabel],White,Label);
    return 1;
}



Re: Updating Names (+rep) - TTJJ - 14.03.2012

Hi Tanush123,

If you refer back to SnG's attempt he has the line "if(GetPlayerBusinessID(playerid) == 1)" - I was simply attempting to understand what he was trying to do with that.

But I see my mistake. I mis-understood the order in which parameters were being used with Update3DTextLabelText.

Indeed. Your new method should fix the issue.

Cheers,

TJ


Re: Updating Names (+rep) - SnG.Scot_MisCuDI - 14.03.2012

Quote:
Originally Posted by TTJJ
Посмотреть сообщение
Hi there,

May I ask what
pawn Код:
if(GetPlayerBusinessID(playerid) == 1)
That line is for?

Also, you have not formatted the business info "bLabel" variable. Try adding this to your code:

pawn Код:
format(BusinessInfo[cpid[playerid]][bLabel],128,"%s",name);
Change the 128 integer to be the length of your bLabel variable.

Cheers,

TJ
Quote:
Originally Posted by Tanush123
Посмотреть сообщение
You mean changing a business name?
Idk where you got getplayerbusinessid from Tee Dynamic Bus well use this
pawn Код:
COMMAND:namebiz(playerid, params[])
{
    new name[128],busid;
    if(sscanf(params,"is",busid,name))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /bizname [name]");
    format(file,sizeof(file),"Business/%i.ini",busid);
    dini_Set(file, "Name", name);
    format(String,sizeof(String),"Biz renamed to: %s",name);
    SendClientMessage(playerid,Green,String);
    format(Label, sizeof(Label), "Business Name: %s\nOwner: No Owner\nCost: $%i\nPayout: $%i", name,dini_Int(file,"Cost"),dini_Int(file,"Payout"));
    Update3DTextLabelText(BusinessInfo[busid][bLabel],White,Label);
    return 1;
}
I was trying to use it to see if the player owned the biz

pawn Код:
COMMAND:namebiz(playerid, params[])
{
    new name[128],busid;
    if(sscanf(params,"is",busid,name))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /bizname [name]");
    format(file,sizeof(file),"Business/%i.ini",busid);
    dini_Set(file, "Name", name);
    format(String,sizeof(String),"Biz renamed to: %s",name);
    SendClientMessage(playerid,Green,String);
    format(Label, sizeof(Label), "Business Name: %s\nOwner: No Owner\nCost: $%i\nPayout: $%i", name,dini_Int(file,"Cost"),dini_Int(file,"Payout"));
    Update3DTextLabelText(BusinessInfo[busid][bLabel],White,Label);
    return 1;
}
And why do they need the biz id? it should be the players biz id already there for them so they need just /namebiz (name)
The players can change the name of the other players biz now. I want it to check if the player owns a biz and set the name of his biz ONLY.


Re: Updating Names (+rep) - SnG.Scot_MisCuDI - 15.03.2012

This works but it sets the name of biz id 0 but after restart of FS it sets the correct biz name
pawn Код:
COMMAND:namebiz(playerid, params[])
{
    new name[128],busid;
    if(sscanf(params,"s",name))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /bizname [name]");
    if(GetPlayerBusinessID(playerid) == -1)return SendClientMessage(playerid,Red,"You do not own a business.");
    format(file,sizeof(file),"Business/%i.ini",GetPlayerBusinessID(playerid));
    dini_Set(file, "Name", name);
    format(String,sizeof(String),"Biz renamed to: %s",name);
    SendClientMessage(playerid,Green,String);
    format(Label, sizeof(Label), "{ccccff}%s\n\n{999999}%s\n{00BC00}Cost: {999999}$%i\n{00BC00}Payout: {999999}$%i",dini_Get(file, "Name"),dini_Get(file, "Owner"),dini_Int(file, "Cost"),dini_Int(file, "Payout"));
    Update3DTextLabelText(BusinessInfo[busid][bLabel],White,Label);
    return 1;
}
Video: http://*********/hjI7rB7EVZQ


Re: Updating Names (+rep) - [ABK]Antonio - 15.03.2012

dini_Set(file, "Name", name);


Get the business name then re-write it inside of the business ID file