[Help] Small BOT script error [SOLVED] -
DukeVega - 31.01.2015
Community peeps,
Thankyou again for your assistance, ... so today I built my first working BOT!! wooo i managed to get him to launch in game and do his little routine. *slow clap*
What I have done is built it on a filterscript
Next job was to change the BOT skin so i tried to do it like this...
Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("Fallout Apocalypse RP - BOTS");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#endif
public OnFilterScriptInit()
{
print("FalloutSA");
ConnectNPC("Civilian","nvciv1");
Setplayerskin(playerid, 162);
return 1;
}
What happens though i get the error
error 017: undefined symbol "Setplayerskin"
Re: [Help] Small BOT script -
CalvinC - 31.01.2015
Use SetPlayerSkin, not Setplayerskin.
Re: [Help] Small BOT script -
DukeVega - 31.01.2015
\filterscripts\BOTS.pwn(30) : error 017: undefined symbol "SetplayerSkin"
Re: [Help] Small BOT script -
CalvinC - 31.01.2015
Pawn is case sensitive, you have to capitalize it like Set Player Skin.
Re: [Help] Small BOT script -
DukeVega - 31.01.2015
fml im an idiot ok yeh worked next error tho
undefined symbol "playerid"
EDIT
tried using " i "
error 017: undefined symbol "i"
Re: [Help] Small BOT script -
DukeVega - 31.01.2015
OKAY TRIED THIS
public OnPlayerConnect(playerid)
{
print("FalloutRP");
ConnectNPC("Civilian","nvciv1");
SetPlayerSkin(playerid, 1);
return 1;
}
AND IT WORKS!!! but it gets weirder
the bot spawns with this skin
But when I run into him it has the VOICE from the skin i set it to
EDIT
Just swopped back to original img file, has not fixed the problem
ALSO tried changing the skin from 1 to 33, again same issue
Re: [Help] Small BOT script -
DukeVega - 31.01.2015
SOLVED
Changed to
public OnPlayerSpawn(playerid)
Re: [Help] Small BOT script -
CalvinC - 31.01.2015
Well you can't just use "i" instead of "playerid", you need to define it.
As you see, functions like OnPlayerConnect has a (playerid) parameter, therefore it's already defined.
People often create a loop between all players, and rename the playerid (that it's looping through) to "i", but you cannot do this if you haven't looped through players and defined "i".
pawn Код:
public OnFilterScriptInit()
As you can see, there's no "playerid" parameter, so you cannot "SetPlayerSkin(playerid".
Also, i don't think OnPlayerConnect is called when a NPC connects to the server, for that you should use
OnNPCConnect.
I know you found a fix to all of this, but just an explanation so you know why these problems occured.