SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 16/09/2019, 03:09 PM   #1
Destinare
Banned
 
Join Date: Jun 2018
Posts: 16
Reputation: 0
Default Bot help [meh sorry]

Is it possible to change a BOT's skin while in game? My bots only stay on 1 skin an I am
Destinare is offline   Reply With Quote
Old 16/09/2019, 03:22 PM   #2
Mad
Little Clucker
 
Mad's Avatar
 
Join Date: Jul 2019
Location: Tunisia
Posts: 15
Reputation: 2
Default Re: Bot help [meh sorry]

Yeah, it's possible. But i can't help you like that. Show me a piece of code or something. And yeah you can create a command to change it in-game and is it a NPC or ACTOR. Because most of the people don't know the difference between them.
Mad is offline   Reply With Quote
Old 16/09/2019, 03:23 PM   #3
Destinare
Banned
 
Join Date: Jun 2018
Posts: 16
Reputation: 0
Default Re: Bot help [meh sorry]

I'm using https://forum.sa-mp.com/showthread.php?t=95034 as a bot system
Destinare is offline   Reply With Quote
Old 16/09/2019, 03:27 PM   #4
Destinare
Banned
 
Join Date: Jun 2018
Posts: 16
Reputation: 0
Default Re: Bot help [meh sorry]

Filterscript pic:



I created the NPC in a filterscript. Then, through that filterscript, I can load the bots in game through a simple CMD of /bot2 which is scripted in the gamemode

Gamemode:
Destinare is offline   Reply With Quote
Old 16/09/2019, 03:34 PM   #5
darkdrago
Huge Clucker
 
darkdrago's Avatar
 
Join Date: Nov 2009
Location: Italy
Posts: 290
Reputation: 38
Default Re: Bot help [meh sorry]

I'm here again to help you
Code:
CMD:changebotskin(playerid, params[])
{
	new pname[MAX_PLAYER_NAME]; //Here we declare pName used to get the NPC name
	for(new i = 0; i < GetPlayerPoolSize(); i++) //We loop through all the players
	{
		GetPlayerName(i, pname, MAX_PLAYER_NAME); //We get every player name 
		if(!strcmp(pname, "NPC NAME", true)) return SetPlayerSkin(i,SKINID); //If the name matches with "NPC NAME" then we set the player skin (Because NPC works like a player)
	}
	return 1;
}
__________________
darkdrago is offline   Reply With Quote
Old 16/09/2019, 03:36 PM   #6
Mad
Little Clucker
 
Mad's Avatar
 
Join Date: Jul 2019
Location: Tunisia
Posts: 15
Reputation: 2
Flowers Re: Bot help [meh sorry]

Well, this is will help. It's an example of OnPlayerSpawn().

Code:
public OnPlayerSpawn(playerid)
{
        if(IsPlayerNPC(playerid)) // This will check if the current player is a NPC.
        {
            new myNPC[24]; // Here we will store the NPC name.
            GetPlayerName(playerid, myNPC,sizeof(myNPC)); // This will get the NPC's name & store it in ' myNPC '. 
            if(!strcmp(myNPC,"YourNPCName",false)) // This will check if the variable stores the right name.
            {
                SetPlayerSkin(playerid, NPCID here); 
           }
          
        }
    return 1;
}



You can use the one darkdrago gave you, it's better than mine.
Mad is offline   Reply With Quote
Old 16/09/2019, 03:38 PM   #7
Destinare
Banned
 
Join Date: Jun 2018
Posts: 16
Reputation: 0
Default Re: Bot help [meh sorry]

Where can I place this in my gamemode?
Destinare is offline   Reply With Quote
Old 16/09/2019, 03:45 PM   #8
darkdrago
Huge Clucker
 
darkdrago's Avatar
 
Join Date: Nov 2009
Location: Italy
Posts: 290
Reputation: 38
Default Re: Bot help [meh sorry]

Quote:
Originally Posted by Destinare View Post
Where can I place this in my gamemode?
Well, where do you need to change your NPC skin? Command? On spawn? Or anything else?
__________________
darkdrago is offline   Reply With Quote
Old 16/09/2019, 03:51 PM   #9
Destinare
Banned
 
Join Date: Jun 2018
Posts: 16
Reputation: 0
Default Re: Bot help [meh sorry]

On command preferably
Destinare is offline   Reply With Quote
Old 16/09/2019, 04:01 PM   #10
darkdrago
Huge Clucker
 
darkdrago's Avatar
 
Join Date: Nov 2009
Location: Italy
Posts: 290
Reputation: 38
Default Re: Bot help [meh sorry]

If you use zcmd take my code and put it somewhere you want, out of any callback, if you use strcmp as command processor convert it and use it under OnPlayerCommandText
Quote:
Originally Posted by darkdrago View Post
I'm here again to help you
Code:
CMD:changebotskin(playerid, params[])
{
	new pname[MAX_PLAYER_NAME]; //Here we declare pName used to get the NPC name
	for(new i = 0; i < GetPlayerPoolSize(); i++) //We loop through all the players
	{
		GetPlayerName(i, pname, MAX_PLAYER_NAME); //We get every player name 
		if(!strcmp(pname, "NPC NAME", true)) return SetPlayerSkin(i,SKINID); //If the name matches with "NPC NAME" then we set the player skin (Because NPC works like a player)
	}
	return 1;
}
__________________
darkdrago is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 02:42 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.