SA-MP Forums

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

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

Ugh this shit is stressing me out saying it isn't cmd. Do you have teamviewer or something
Destinare is offline   Reply With Quote
Old 16/09/2019, 06:29 PM   #12
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
Ugh this shit is stressing me out saying it isn't cmd. Do you have teamviewer or something
I do, but i rather prefer to help here so everyone could learn, have you got your commands in strcmp?
__________________
darkdrago is offline   Reply With Quote
Old 17/09/2019, 03:56 AM   #13
Destinare
Banned
 
Join Date: Jun 2018
Posts: 16
Reputation: 0
Default Re: Bot help [meh sorry]

Yes I use strcmp to load my bot. For ex: /bot2 loads in my bot.
Destinare is offline   Reply With Quote
Old 17/09/2019, 05:03 AM   #14
darkdrago
Huge Clucker
 
darkdrago's Avatar
 
Join Date: Nov 2009
Location: Italy
Posts: 290
Reputation: 38
Default Re: Bot help [meh sorry]

Code:
if(strcmp("/changebotskin", cmd, true) == 0)
{
	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;
}
Inside OnPlayerCommandText
__________________
darkdrago is offline   Reply With Quote
Old 18/09/2019, 10:37 AM   #15
Destinare
Banned
 
Join Date: Jun 2018
Posts: 16
Reputation: 0
Default Re: Bot help [meh sorry]

D:\Grand Theft Autos\SERVERS\bot server\filterscripts\bot3.pwn(96) : error 017: undefined symbol "cmd"

Destinare is offline   Reply With Quote
Old 18/09/2019, 10:53 AM   #16
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,202
Reputation: 390
Default Re: Bot help [meh sorry]

What the fuck is this? retards land? fuck off guys you're all stupid jesus christ!!

NPCs are treated as normal players

You can change the skin using a normal zcmd command and SetPlayerSkin for fucks sake why are you all making it complicated!

use zcmd: https://forum.sa-mp.com/showthread.php?t=91354
and sscanf: https://github.com/maddinat0r/sscanf/releases
and a simple command such as this:
PHP Code:
CMD:setskin(playeridparams[])
{
    new 
userskin;
    if(
sscanf(params"ri"userskin)) return SendClientMessage(playerid, -1"Please mention player id/name followed by the skin id");
    
SetPlayerSkin(userskin);
    
SendClientMessage(playerid, -1"Skin was set to the player");
    return 
1;

Why the fuck would you loop through all players to do that shit that's retarded, an even easier solution if you're setting a basic skin for all NPCs is setting the skin after it connects.

Also can you all stop typing in colors that's stupid as fuck.

Dumbasses jesus...


Also @ OP

Read this: https://forum.sa-mp.com/showthread.php?t=256961
Your code looks like shit and i wouldn't advise using pawno as it doesn't help with indentation at all,
you can use sublime or vscode, tutorials are on the forum to help you use them with the pawn compiler.

And your issue says 'undefined symbol cmd' because at line 96 you are trying to compare a string to 'cmd' which is a variable that isn't declared, replacing 'cmd' with 'cmdtext' will fix it but it looks like you don't have a flying clue about what you're doing so i would advise reading some tutorials first.
__________________
Quote:
Originally Posted by Andy
I offer paid scripting services, I can do anything except mapping because fuck mapping.

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link
RogueDrifter is offline   Reply With Quote
Old 18/09/2019, 11:13 AM   #17
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 RogueDrifter View Post
What the fuck is this? retards land? fuck off guys you're all stupid jesus christ!!
Why the fuck would you loop through all players to do that shit that's retarded, an even easier solution if you're setting a basic skin for all NPCs is setting the skin after it connects.

Also can you all stop typing in colors that's stupid as fuck.

Dumbasses jesus...
Did he wanted a SetPlayerSkin command for every player or a command to set the specific NPC's skin?
The loop was obviously to search the NPC's ID.
He probably don't even want to search for his NPC's id, btw what's wrong with my command? You just rushed the things without even thinking that the solution provided was fine already, he just didn't knew that he should have replaced "cmd" with "cmdtext", fuck you and your stupid attitude, autistic shit who can't even follow the damn thread.
Respect the people who spends their time trying to help each other, it's not anyone's problem if he doesn't knows how to put a command and obviously the thread will get long, the problem was solved already in my first post, dumbass.
__________________

Last edited by darkdrago; 18/09/2019 at 12:10 PM.
darkdrago is offline   Reply With Quote
Old 19/09/2019, 03:03 PM   #18
Threshold
High-roller
 
Threshold's Avatar
 
Join Date: Nov 2012
Location: Australia
Posts: 3,108
Reputation: 521
Default Re: Bot help [meh sorry]

A better solution would be to use OnPlayerConnect so you don't have to handle with finding the NPC's player ID, or alternatively you can just save the NPC's ID to a global variable when it connects, for later use.

PHP Code:
public OnPlayerConnect(playerid)
{
    if(
IsPlayerNPC(playerid))
    {
        new 
p_name[MAX_PLAYER_NAME];
        
GetPlayerName(playeridp_namesizeof(p_name));
        if(
strcmp(p_name"bot2"true)) SetSpawnInfo(playeridNO_TEAMskin0.00.03.00.0000000);
        
// Replace 'skin' with the appropriate skin ID and the positions to whatever you require.
        
else if(strcmp(p_name"lvpdbot1"true)) SetSpawnInfo(playeridNO_TEAMskin0.00.03.000000);
        
// Replace 'skin' with the appropriate skin ID and the positions to whatever you require.
    
}
    
// ...
    
return 1;

Also, your commands are reading 'do not exist' because you are using the length parameter in 'strcmp' incorrectly. Your command "bot3" is only 4 characters long, but you are using a length of 10.
http://wiki.sa-mp.com/wiki/Strcmp
PHP Code:
if(strcmp("bot3"cmdtexttrue) == 0
Remove the length parameter and it will be automatically assigned.

I would also recommend looking into using SSCANF and ZCMD or YCMD as they are the more modern alternative, as RogueDrifter mentioned in his tantrum.
--

@RogueDrifter
Chill out.

@darkdrago
When using 'GetPlayerPoolSize', it returns the highest player ID. So in your iterations, you should use 'i <= GetPlayerPoolSize'. For optimisation purposes, we simply do this:
PHP Code:
for(new 0GetPlayerPoolSize(); <= j; ++i
Such that we only call GetPlayerPoolSize once and save it.

http://wiki.sa-mp.com/wiki/Strcmp
http://wiki.sa-mp.com/wiki/SetSpawnInfo
http://wiki.sa-mp.com/wiki/IsPlayerNPC
__________________

Kar's Cops and Robbers 2019
Threshold 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 03:11 PM.


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