All My Zcmd Return to id 0
#1

title Explain its self :\
Reply
#2

This was literary made today, please search before posting.

As the title explains, it's probably because of your sscanf (if you are using sscanf)

If not, show some code.
Reply
#3

Quote:
Originally Posted by Kindred
Посмотреть сообщение
This was literary made today, please search before posting.

As the title explains, it's probably because of your sscanf (if you are using sscanf)

If not, show some code.
Yeah i checked dat link , i do every step but The same nothing changed
and yes i am using sscanf so that won't make Zcmd Work ?
Reply
#4

So you followed all of the steps? Including the fact you have to recompile it after updating the plugin and so forth?

If it still doesn't work, then I guess your not doing it right or something, this is (i think) the only reason the ID 0 bug would happen if you use sscanf.
Reply
#5

Ah i will show some of my Zcommands
Код:
COMMAND:kick(playerid, params[])
{
    if(AccountInfo[playerid][AdminLevel] >= 2)
	{
	new targetid = strval(params);
	new pName[MAX_PLAYER_NAME];
	GetPlayerName(targetid, pName, sizeof(pName));
	if(!IsPlayerAdmin(playerid)) return 0;
	new reason[64], string[128];
	if(sscanf(params, "uz", targetid, reason)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "Usage:{FFFFFF} /kick [playerid/partofname] [reason]"); // here it tells the player to use /kick playerid reason or /kick partofname reason
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "Player not connected or is yourself!");
    format(string, sizeof(string), "{FF0000}%s{FCFCFC} has been kicked by An Admin {FF0000}({FCFCFC}Reason:{09FF00} %s{FF0000})",pName, reason);
	SendClientMessageToAll(COLOR_YELLOW, string);
	Kick(targetid);
	}
	return 1;
}
COMMAND:ban(playerid, params[])
{
   if(AccountInfo[playerid][AdminLevel] >= 3)
	{
	new targetid = strval(params);
	new pName[MAX_PLAYER_NAME];
	GetPlayerName(targetid, pName, sizeof(pName));
	if(!IsPlayerAdmin(playerid)) return 0;
	new reason[64], string[128];
	if(sscanf(params, "uz", targetid, reason)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "Usage:{FFFFFF} /ban [playerid/partofname] [reason]"); // here it tells the player to use /kick playerid reason or /kick partofname reason
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "Player not connected or is yourself!");
	format(string, sizeof(string), "{FF0000}%s{FCFCFC} has been banned by An Admin {FF0000}({FCFCFC}Reason:{09FF00} %s{FF0000})",pName, reason);
	SendClientMessageToAll(COLOR_YELLOW, string);
	Ban(targetid);
	}
return 1;
}
COMMAND:heal(playerid, params[])
{
    if(AccountInfo[playerid][AdminLevel] >= 2)
	{
		new id;
 		if (sscanf(params, "u", id)) return SendClientMessage(playerid, 0xFF0000AA, "Usage:{FFFFFF} \"/heal <playerid>\"");
		if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "Player not {FFFFFF}found");
		SetPlayerHealth(id, 100.0);
		SendClientMessage(id, 0x00FF00AA, "You have been healed");
		SendClientMessage(playerid, 0x00FF00AA, "Player healed");
	}
	else return SendClientMessage(playerid,COLOR_WHITE,"You Have To Be Admin Level {FFFFFF}1");
	return 1;
}
Reply
#6

It's sscanf or sscanf2 ?
Reply
#7

sscanf2
Reply
#8

In laymens, just uninstall everything, download latest, re-install, re-compile. Those are the steps you should always take when problems like these arise. There is always a reason behind something. Specifically in sa-mp scripting.
Reply
#9

One suggestion
Why you putting GetPlayerName before the sscanf? Put it after the sscanf
Because if you have NPC in your server, the targetname will be the NPC Name.

Just suggesting.
Reply
#10

Update sscanf plugin and include...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)