TogglePlayerSpectating
Scanff Dcmd/zcmd Just learn to use those ... |
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(spec,4,cmdtext);
return 0;
}
dcmd_spec(playerid, params[])
{
new
id;
if (sscanf(params, "u", id)) SendClientMessage(playerid,0xFF0000AA, "USAGE: /spec id");
else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid,0xFF0000AA, "Player is not found");
else
if(IsPlayerAdmin(playerid))
{
TogglePlayerSpectating(playerid, 1);
}
return 1;
}
Well im sure you got dcmd and sscanf
Here u go u must be logged in as admin pawn Код:
pawn Код:
NOT TESTED |
dcmd_spec(playerid, params[])
{
new
id;
if (sscanf(params, "u", id)) SendClientMessage(playerid,0xFF0000AA, "USAGE: /spec id");
else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid,0xFF0000AA, "Player is not found");
else
if(IsPlayerAdmin(playerid))
{
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, id);
}
return 1;
}
Yea but you forgot one thing.
PlayerSpectatePlayer(playerid, id); pawn Код:
Should work now |
#include <a_samp>
#include <dcmd>
#include <sscanf>
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(spec,4,cmdtext);
return 0;
}
dcmd_spec(playerid, params[])
{
new
id;
if (sscanf(params, "u", id)) SendClientMessage(playerid,0xFF0000AA, "USAGE: /spec id");
else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid,0xFF0000AA, "Player is not found");
else
if(IsPlayerAdmin(playerid))
{
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, id);
}
return 1;
}
C:\Users\Larsey123\Documents\SAMP Server\My server\pawno\include\sscanf.inc(4) : error 021: symbol already defined: "sscanf"
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\Spec.pwn(21) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1