SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 30/11/2013, 04:37 PM   #1
Bost
Little Clucker
 
Join Date: Oct 2011
Posts: 47
Reputation: 0
Default What's wrong here..

I made this:
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/help", true))
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "To be updated.");
        return 1;
        // Returning 1 informs the server that the command has been processed.
        // OnPlayerCommandText won't be called in other scripts.
    }
    return 0;
    // Returning 0 informs the server that the command hasn't been processed by this script.
    // OnPlayerCommandText will be called in other scripts until one returns 1.
    // If no scripts return 1, the 'SERVER: Unknown Command' message will be shown.
}

if(!strcmp(cmdtext, "/help", true))
{
	if(IsPlayerConnected(playerid))
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "To be updated.");
	}
 	return 1;
}
And I get this errors:
Code:
F:\Jocuri, programe\Game-Mode\samp03x_svr_R2_win32\gamemodes\game.pwn(97) : error 010: invalid function or declaration
F:\Games\Game-Mode\....\gamemodes\game.pwn(99) : error 010: invalid function or declaration
F:\Games\Game-Mode\....\gamemodes\game.pwn(103) : error 010: invalid function or declaration
What to do?
__________________
Boooooooooooooooooooooooooo
Bost is offline   Reply With Quote
Old 30/11/2013, 04:41 PM   #2
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,831
Reputation: 1401
Default Re: What's wrong here..

Any code out of callbacks is invalid. You already got the command /help so a double one is really pointless. It's also pointless to check if the playerid is connected player because if the player was not, then the callback would not even get called.

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/help", true))
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "To be updated.");
        return 1;
    }
    return 0;
}
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 30/11/2013, 05:18 PM   #3
Bost
Little Clucker
 
Join Date: Oct 2011
Posts: 47
Reputation: 0
Default Re: What's wrong here..

Code:
	if(!strcmp(cmdtext, "/make", true))
	{
		SendClientMessage(playerid, 0xFFFFFFFF, "To be updated.");
	}
 	return 1;
}
Did this, but I still get those:

Code:
F:\.....\Game-Mode\....\gamemodes\game.pwn(97) : error 010: invalid function or declaration
F:\....\Game-Mode\....\gamemodes\game.pwn(101) : error 010: invalid function or declaration
__________________
Boooooooooooooooooooooooooo
Bost is offline   Reply With Quote
Old 30/11/2013, 06:19 PM   #4
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,831
Reputation: 1401
Default Re: What's wrong here..

Post lines 95-105.
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 30/11/2013, 06:30 PM   #5
Bost
Little Clucker
 
Join Date: Oct 2011
Posts: 47
Reputation: 0
Default Re: What's wrong here..

Code:
}

	if(!strcmp(cmdtext, "/make", true))
	{
		SendClientMessage(playerid, 0xFFFFFFFF, "To be updated.");
	}
 	return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
__________________
Boooooooooooooooooooooooooo
Bost is offline   Reply With Quote
Old 30/11/2013, 06:41 PM   #6
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,831
Reputation: 1401
Default Re: What's wrong here..

I told you any code out of callbacks is invalid and you re-added outside.

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/help", true))
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "To be updated.");
        return 1;
    }
    // other commands
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    // code..
    return 1;
}
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 30/11/2013, 07:03 PM   #7
Bost
Little Clucker
 
Join Date: Oct 2011
Posts: 47
Reputation: 0
Default Re: What's wrong here..

Thanks, solved.
__________________
Boooooooooooooooooooooooooo
Bost is offline   Reply With Quote
Old 30/11/2013, 11:10 PM   #8
Mitchy
Banned
 
Join Date: Feb 2013
Posts: 141
Reputation: -15
Default Re: What's wrong here..

Like @Konstantinos said: Any command performed outside of a callback using strcmp will -not- work. If you don't want to have all of your commands inside a callback then try using command processors such as Z-CMD or Y-CMD.

P.S: strcmp commands are archaic.
Mitchy 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nothing is wrong but it sends wrong text? Guitar Scripting Help 1 21/08/2012 01:30 PM
showing wrong/wrong string TextDraws Voldemort Help Archive 5 22/02/2011 05:50 PM
What's wrong AGAIN :( sekol Help Archive 5 19/02/2011 07:04 AM
What is wrong here Carrera Help Archive 2 16/07/2010 04:53 AM


All times are GMT. The time now is 03:21 PM.


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