Having a bit of trouble with spec :S -
KyLeBlaK - 19.10.2014
So hey guys, i've been looking for about an hour and a half trying to find a /spec <ID> which also turns spec off when you type /spec, i've got my old code for the spec, can anyone help me change it so i don't have to write /specoff ?
Код:
ACMD:spec(playerid, params[])
{
new id;
if (pInfo[playerid][Adminlevel] < 2) return 0;
if(sscanf(params,"u", id))return SCM(playerid, -1, "--- /spec {33CCFF}<ID/Name> {FFFFFF}---");
if(id == INVALID_PLAYER_ID)return SCM(playerid, red, "Player not connected!");
GetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);
Inter[playerid] = GetPlayerInterior(playerid);
vWorld[playerid] = GetPlayerVirtualWorld(playerid);
TogglePlayerSpectating(playerid, true);
if(IsPlayerInAnyVehicle(id))
{
if(GetPlayerInterior(id) > 0)
{
SetPlayerInterior(playerid,GetPlayerInterior(id));
}
if(GetPlayerVirtualWorld(id) > 0)
{
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
}
PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));
}
else
{
if(GetPlayerInterior(id) > 0)
{
SetPlayerInterior(playerid,GetPlayerInterior(id));
}
if(GetPlayerVirtualWorld(id) > 0)
{
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
}
PlayerSpectatePlayer(playerid,id);
}
GetPlayerName(id, Name, sizeof(Name));
format(String, sizeof(String),"{AFAFAF}[Admin]: {FFFFFF}You are spectating {33CCFF}%s.{FFFFFF}",Name);
SCM(playerid, -1,String);
IsSpecing[playerid] = 1;
IsBeingSpeced[id] = 1;
spectatorid[playerid] = id;
return 1;
}
Here is the specoff code as well
Код:
ACMD:specoff(playerid, params[])
{
if (pInfo[playerid][Adminlevel] < 2) return 0;
TogglePlayerSpectating(playerid, 0);
return 1;
}
EDIT: can yous also help me with a /mute <ID> <Minutes> <reason> command, i've been looking around and can't find one that works goodly
And can you help me with something what would i need to use to get the name of a player like /h <ID> <text> so when you do it, it says 'BlK(5): Playersname hey welcome to the server'
Re: Having a bit of trouble with spec :S -
Abagail - 19.10.2014
pawn Код:
ACMD:spec(playerid, params[])
{
new id;
if (pInfo[playerid][Adminlevel] < 2) return 0;
if(IsSpectating[playerid] == 1) cmd_specoff(playerid, params);
if(sscanf(params,"u", id))return SCM(playerid, -1, "--- /spec {33CCFF}<ID/Name> {FFFFFF}---");
if(id == INVALID_PLAYER_ID)return SCM(playerid, red, "Player not connected!");
GetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);
Inter[playerid] = GetPlayerInterior(playerid);
vWorld[playerid] = GetPlayerVirtualWorld(playerid);
TogglePlayerSpectating(playerid, true);
if(IsPlayerInAnyVehicle(id))
{
if(GetPlayerInterior(id) > 0)
{
SetPlayerInterior(playerid,GetPlayerInterior(id));
}
if(GetPlayerVirtualWorld(id) > 0)
{
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
}
PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));
}
else
{
if(GetPlayerInterior(id) > 0)
{
SetPlayerInterior(playerid,GetPlayerInterior(id));
}
if(GetPlayerVirtualWorld(id) > 0)
{
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
}
PlayerSpectatePlayer(playerid,id);
}
GetPlayerName(id, Name, sizeof(Name));
format(String, sizeof(String),"{AFAFAF}[Admin]: {FFFFFF}You are spectating {33CCFF}%s.{FFFFFF}",Name);
SCM(playerid, -1,String);
IsSpecing[playerid] = 1;
IsBeingSpeced[id] = 1;
spectatorid[playerid] = id;
return 1;
}
Basically, - if the spec variable is set, - it calls the spec off command. Pretty straight-forward.
Re: Having a bit of trouble with spec :S -
KyLeBlaK - 19.10.2014
Now i'm getting errors
Код:
C:\Users\BLACK\Desktop\Race Server\filterscripts\Accounts.pwn(460) : error 017: undefined symbol "IsSpectating"
C:\Users\BLACK\Desktop\Race Server\filterscripts\Accounts.pwn(460) : warning 215: expression has no effect
C:\Users\BLACK\Desktop\Race Server\filterscripts\Accounts.pwn(460) : error 001: expected token: ";", but found "]"
C:\Users\BLACK\Desktop\Race Server\filterscripts\Accounts.pwn(460) : error 029: invalid expression, assumed zero
C:\Users\BLACK\Desktop\Race Server\filterscripts\Accounts.pwn(460) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.