Problem with /slap
#1

Hey again xD

I have a little problem. I type /slap [ID]. The script donґt give a shit what ID I am xD So I type in: /slap 5 but I am ID 0 and it slaps me D:

How to fix it?

Код:
dcmd_slap(playerid, params[])
{
	new slapid;
	if(PlayerInfo[playerid][AdminLevel] < 1) return false;
	if(sscanf(params, "u", slapid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /slap [playerid]");
  if(!IsPlayerConnected(slapid)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "ERROR: Player not found");
	{
	new Float:X, Float:Y, Float:Z,AdminName[MAX_PLAYER_NAME],SlapName[MAX_PLAYER_NAME],SlapMessage[128];
	GetPlayerPos(slapid, X, Y, Z);
	SetPlayerPos(slapid, X, Y, Z+11);
	GetPlayerName(slapid, SlapName, sizeof(SlapName));
	GetPlayerName(playerid, AdminName, sizeof(AdminName));
	format(SlapMessage, sizeof(SlapMessage), "%s has been slapped by %s!", SlapName, AdminName);
	SendAdminMsg(COLOR_WHITE, SlapMessage);
	}
	return 1;
}
Reply
#2

Код:
dcmd_slap(playerid, params[])
{
	new slapid; 
       new Index;
	new tmp[256]; tmp = strtok(params,Index);
       slapid=strval(tmp);
	if(PlayerInfo[playerid][AdminLevel] < 1) return false;
	if(sscanf(params, "u", slapid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /slap [playerid]");
  if(!IsPlayerConnected(slapid)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "ERROR: Player not found");
	{
	new Float:X, Float:Y, Float:Z,AdminName[MAX_PLAYER_NAME],SlapName[MAX_PLAYER_NAME],SlapMessage[128];
	GetPlayerPos(slapid, X, Y, Z);
	SetPlayerPos(slapid, X, Y, Z+11);
	GetPlayerName(slapid, SlapName, sizeof(SlapName));
	GetPlayerName(playerid, AdminName, sizeof(AdminName));
	format(SlapMessage, sizeof(SlapMessage), "%s has been slapped by %s!", SlapName, AdminName);
	SendAdminMsg(COLOR_WHITE, SlapMessage);
	}
	return 1;
}
Reply
#3

Wonderful I learned something new
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)