Not working ... (+rep) -
Dripac - 19.04.2012
This is the stock
pawn Код:
stock GetNearestBot(playerid, Float:abstand)
{
new Float:pX, Float:pY, Float:pZ, Float:vX, Float:vZ, Float:vY;
GetPlayerPos(playerid, pX, pY, pZ);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerNPC(i))
{
GetPlayerPos(i, vX, vY, vZ);
if(floatabs(pX-vX) < abstand && floatabs(pY-vY) < abstand && floatabs(pZ-vZ) < abstand && i != playerid)
{
return i;
}
}
}
return 9999;
}
And i use this at OnPlayerText
pawn Код:
new bot = GetNearestBot(playerid);
pawn Код:
if(!strcmp(GetName(bot),"MikeTheBarkeeper",true))
{
if(!strcmp(text,"bier",true))
{
BarMenBusy = 1;
PlayerOrder[playerid] = "bier";
SetPlayerChatBubble(bot,"Mike: {FFFFFF}Kleinen Moment bitte...",0xFFFF00DD,35.0,3000);
ApplyAnimation(bot, "BAR","Barserve_bottle", 4.0, 0, 0, 0, 0, 0, 1);
SetTimerEx("GetBottle",3001,false,"ii",bot,playerid);
}
but now if i type in chat "bier", nothing happens, only the message show, it should give me beer...
I also get that warning at new bot = GetNearestBot
"tag mismatch"
Re: Not working ... (+rep) -
ViniBorn - 19.04.2012
pawn Код:
GetNearestBot(playerid, Float:abstand)
pawn Код:
new bot = GetNearestBot(playerid); // need 'abstand'
Re: Not working ... (+rep) -
Dripac - 19.04.2012
I tried to put number 5, the warning was gone but it still doesn't work in-game
Re: Not working ... (+rep) -
MeDaKewlDude - 19.04.2012
Код:
if(!strcmp(GetName(bot),"MikeTheBarkeeper",true))
{
if(!strcmp(text,"bier",true))
{
BarMenBusy = 1;
PlayerOrder[playerid] = "bier";
SetPlayerChatBubble(bot,"Mike: {FFFFFF}Kleinen Moment bitte...",0xFFFF00DD,35.0,3000);
ApplyAnimation(bot, "BAR","Barserve_bottle", 4.0, 0, 0, 0, 0, 0, 1);
SetTimerEx("GetBottle",3001,false,"ii",bot,playerid);
}
}
there, i think you forgot the last bracket.
Re: Not working ... (+rep) -
Dripac - 19.04.2012
Its not because of the bracket, i already got that
Re: Not working ... (+rep) -
MeDaKewlDude - 19.04.2012
i think it might be something else in the script. i tryed to recreate the script and it worked:
Код:
new BarMenBusy = 0;
new PlayerOrder[MAX_PLAYERS][128];
forward GetBottle(bot,playerid);
stock GetNearestPlayer(playerid, Float:range)
{
new Float:pX, Float:pY, Float:pZ, Float:vX, Float:vZ, Float:vY;
GetPlayerPos(playerid, pX, pY, pZ);
for(new i = 0; i < MAX_PLAYERS; i++)
{
GetPlayerPos(i, vX, vY, vZ);
if(floatabs(pX-vX) < range && floatabs(pY-vY) < range && floatabs(pZ-vZ) < range && i != playerid)
{
return i;
}
}
return 99999;
}
stock GetName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
return name;
}
public OnPlayerText(playerid, text[])
{
new bot = GetNearestPlayer(playerid,5.0);
if(!strcmp(GetName(bot),"MikeTheBarkeeper",true))
{
if(!strcmp(text,"bier",true))
{
BarMenBusy = 1;
PlayerOrder[playerid] = "bier";
SetPlayerChatBubble(bot,"Mike: {FFFFFF}Kleinen Moment bitte...",0xFFFF00DD,35.0,3000);
ApplyAnimation(bot, "BAR","Barserve_bottle", 4.0, 0, 0, 0, 0, 0, 1);
SetTimerEx("GetBottle",3001,false,"ii",bot,playerid);
}
}
}
public GetBottle(bot,playerid)
{
BarMenBusy = 0;
ApplyAnimation(bot, "BAR","Barserve_give", 4.0, 0, 0, 0, 0, 0, 1);
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_BEER);
}
im not sure if that would help, but that worked for me.
Re: Not working ... (+rep) -
Dripac - 19.04.2012
Thanks, +rep