SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 28/03/2020, 03:21 AM   #1
MarianImmortalGod
Big Clucker
 
Join Date: Mar 2018
Posts: 80
Reputation: 1
Default Question about desync and unknown command

Hello, in the past 7 days i get an error when i use some commands i get 'Unknown command' or 'The player is not online' but i am in the server, what can cause this ?

This is a command that give's me that error some times when i use it on id 0

Code:
CMD:goto(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid, -1, "Nu ai gradul necesar.");

	new id;
	if(sscanf(params, "r", id)) return SCM(playerid, -1, "Sintaxa: /goto [ID / Nume]");
	if(id == playerid) return SCM(playerid, -1, "Nu poti folosi aceasta comanda asupra ta.");
	if(!IsPlayerConnected(id) && id == INVALID_PLAYER_ID) return SCM(playerid, -1, "Acel jucator nu este conectat.");

	InBizz[id] = 0, InHQ[id] = 0, InHouse[id] = 0;
	new Float:x, Float:y, Float:z;
    GetPlayerPos(id, x, y, z);
    SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id));
	SetPlayerInterior(playerid, GetPlayerInterior(id));
	SetPlayerPos(playerid, x, y+1, z);

	format(gString, sizeof(gString), "[AdmCMD]: Adminul %s s-a teleportat la %s(%d).", GetName(playerid), GetName(id), id);
    SendAdminsMessage(1, COLOR_LIGHTRED, gString);
	return 1;
}
Any idea ?
MarianImmortalGod is offline   Reply With Quote
Old 28/03/2020, 03:48 AM   #2
Kaliber
High-roller
 
Kaliber's Avatar
 
Join Date: Jun 2012
Location: Localhost
Posts: 1,091
Reputation: 156
Default Re: Question about desync and unknown command

Just write:

PHP Code:
if(!IsPlayerConnected(id)) 
Besides that, load crashdetect and look in the server log
__________________
Kaliber is offline   Reply With Quote
Old 28/03/2020, 04:08 AM   #3
MarianImmortalGod
Big Clucker
 
Join Date: Mar 2018
Posts: 80
Reputation: 1
Default Re: Question about desync and unknown command

Quote:
Originally Posted by Kaliber View Post
Just write:

PHP Code:
if(!IsPlayerConnected(id)) 
Besides that, load crashdetect and look in the server log
I did that used only isplayerconnected and crashdetect, but i don't get any problem in server log, everything works verry good.

EDIT: *** YSI Warning: y_malloc set up via "CallLocalFunction", memory corruption is a remote possibility

I had this problem before settled my includes like this, maybe this can get some miss data.

Code:
#include 		<a_samp>
#include 		<crashdetect>
#include 		<YSI_Data\y_iterate>
#include 		<YSI_Coding\y_timers>
#include 		<a_mysql>
#include 		<zcmd>
#include 		<streamer>
#include 		<foreach>
#include 		<sscanf2>
#include 		<fly>
#include 		<playerzone>
#include 		<beaZone>
MarianImmortalGod is offline   Reply With Quote
Old 28/03/2020, 04:10 AM   #4
khRamin78
Huge Clucker
 
khRamin78's Avatar
 
Join Date: Jun 2015
Location: IRI/LA
Posts: 321
Reputation: 30
Default Re: Question about desync and unknown command

The problem is
PHP Code:
if(!IsPlayerConnected(id) && id == INVALID_PLAYER_ID) return SCM(playerid, -1"Acel jucator nu este conectat."); 
You need to change it to :
PHP Code:
if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SCM(playerid, -1"Acel jucator nu este conectat."); 
Cause there is maybe a valid player id but not connected ! so && checks for both!
khRamin78 is offline   Reply With Quote
Old 28/03/2020, 04:18 AM   #5
MarianImmortalGod
Big Clucker
 
Join Date: Mar 2018
Posts: 80
Reputation: 1
Default Re: Question about desync and unknown command

Quote:
Originally Posted by khRamin78 View Post
The problem is
PHP Code:
if(!IsPlayerConnected(id) && id == INVALID_PLAYER_ID) return SCM(playerid, -1"Acel jucator nu este conectat."); 
You need to change it to :
PHP Code:
if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SCM(playerid, -1"Acel jucator nu este conectat."); 
Cause there is maybe a valid player id but not connected ! so && checks for both!
I did that, now i have

Code:
if(!IsPlayerConnected(id))
But the problem is still up, why i can get desync and problem with ID, if players are joinning the server the problem start to get weirder, if id 0 is bugged for each player that join the bug get's on +1 id.

Code:
Id 0 bugged, +1 player join
Id 1 is bugged now
MarianImmortalGod is offline   Reply With Quote
Old 28/03/2020, 04:29 AM   #6
khRamin78
Huge Clucker
 
khRamin78's Avatar
 
Join Date: Jun 2015
Location: IRI/LA
Posts: 321
Reputation: 30
Default Re: Question about desync and unknown command

wierd show us defination of
InBizz[id] = 0, InHQ[id] = 0, InHouse[id] = 0;
also Send Admin message every detail that may help us
khRamin78 is offline   Reply With Quote
Old 28/03/2020, 04:34 AM   #7
MarianImmortalGod
Big Clucker
 
Join Date: Mar 2018
Posts: 80
Reputation: 1
Default Re: Question about desync and unknown command

Quote:
Originally Posted by khRamin78 View Post
wierd show us defination of
InBizz[id] = 0, InHQ[id] = 0, InHouse[id] = 0;
also Send Admin message every detail that may help us
This
Code:
InBizz [id] = 0, InHQ [id] = 0, InHouse [id] = 0;
Does nothing to that command, i changed to [playerid] cause it supposed to activate them on me.
Does variables tell me if i am in a faction hq, bizz or house interior.

This problem with desync or 'Unknown command' or 'Uknown player, is not connected' can't get from any other system ? like a 'task' 'timer'

Like i have a 'task' that return 1; it supposed to be return 1 or nothing ?

Code:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
	if(!success) SCM(playerid, -1, "Unknown command.");
	return 1;
}
MarianImmortalGod 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
Help with YCMD proces command and problem with "Server:Unknown command JoDe Scripting Help 1 20/04/2018 12:12 PM
Question why does it say unknown command? jueix Scripting Help 3 19/08/2013 04:18 PM
[Question] Unknown Command tony_fitto Scripting Help 2 04/10/2011 08:49 PM
(Question) Unknown Command Almighty Socrates Help Archive 6 18/05/2010 09:18 PM
[Question/help] Server: Unknown Command tony_fitto Help Archive 6 04/03/2010 01:35 PM


All times are GMT. The time now is 10:45 AM.


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