Accent not shown - 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: Accent not shown (
/showthread.php?tid=425212)
Accent not shown -
Nivniv2 - 25.03.2013
Код:
switch(PlayerInfo[playerid][pAccent])
{
case 0, 1:
{
new accent;
accent = PlayerInfo[playerid][pAccent];
format(string, sizeof(string), "(%s Accent) %s says: %s", accent, sendername, text);
ProxDetector(20.0, playerid,string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
SetPlayerChatBubble(playerid,text,COLOR_WHITE,20.0,5000);
ProxDetector(30.0, playerid, string,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_FADE1,COLOR_FADE2);
}
When im writing something its says: "( Accent) Admin: test" after i did /accent Admin, its should show "(Admin Accent) Admin: test"
/accent command:
Код:
CMD:accent(playerid, params[])
{
if(sscanf(params, "s[16]", params))
{
SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /accent [accent]");
SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /accent none - to remove your accent!");
return 1;
}
if(!strcmp(params, "none"))
{
format(PlayerInfo[playerid][pAccent], PlayerInfo[playerid][pAccent], "");
SendClientMessage(playerid, COLOR_LIGHTBLUE, " You are not using any accent now.");
}
format(PlayerInfo[playerid][pAccent], PlayerInfo[playerid][pAccent], "%s", params);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are now using "%s" accent.", params);
return 1;
}
Re: Accent not shown -
LarzI - 25.03.2013
pAccent is a string, yet you're declaring and assigning it to an integer. That's two faulty things to do in one:
1. Assign string to an integer
2. Declare a variable to hold information from another variable, even when you use it only once.
It's not timesaving nor more efficient.
Simply use PlayerInfo[playerid][pAccent] instead of accent and you should be fine.