[HELP] Admin command!!!! Somebody help me. Thanks -
BlackSkull - 09.04.2010
Could someone please help me in this command, When I use xspecoff I return to my start and respawn lose my arms, money and position. Could someone help me fix this annoying problem I'm having clauses.
(FS)
In FS Admin:
Код:
public OnPlayerSpawn(playerid) {
if(Variables[playerid][Jailed]) { SetPlayerInterior(playerid,3); SetPlayerPos(playerid,197.6661,173.8179,1003.0234); SetPlayerFacingAngle(playerid,0); }
return 1;
}
Код:
dcmd_spec(playerid,params[]) {
if(IsPlayerCommandLevel(playerid,"spec")) {
if(!strlen(params)) return SendClientMessage(playerid,red,"Syntax Error: \"/SPEC <NICK OR ID | OFF>\".");
new id;
if(!IsNumeric(params)) {
if(!strcmp(params,"off",true)) {
if(!Spec[playerid][Spectating]) return SendClientMessage(playerid,red,"ERROR: You must be spectating.");
SendCommandMessageToAdmins(playerid,"SPEC OFF");
TogglePlayerSpectating(playerid,false);
Spec[playerid][Spectating] = false;
return SendClientMessage(playerid,yellow,"You have turned your spectator mode off.");
}
id = ReturnPlayerID(params);
}
else id = strval(params);
if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID && id != playerid) {
SendCommandMessageToAdmins(playerid,"SPEC");
new string[256],name[24]; GetPlayerName(id,name,24);
if(Spec[id][Spectating]) return SendClientMessage(playerid,red,"Error: You can not spectate a player already spectating.");
if(Spec[playerid][Spectating] && Spec[playerid][SpectateID] == id) return SendClientMessage(playerid,red,"ERROR: You are already spectating this player.");
Spec[playerid][Spectating] = true, Spec[playerid][SpectateID] = id;
SetPlayerInterior(playerid,GetPlayerInterior(id));
TogglePlayerSpectating(playerid,true);
if(!IsPlayerInAnyVehicle(id)) PlayerSpectatePlayer(playerid,id);
else PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));
format(string,256,"You are now spectating player \"%s\".",name); return SendClientMessage(playerid,yellow,string);
} else return SendClientMessage(playerid,red,"ERROR: You can not spectate yourself or a disconnected player.");
} else return SendLevelErrorMessage(playerid,"spec");
}
================================================== ================================================== =============
(GM)
GameMode Spawn after using xspecoff:
Код:
new Float:gCopPlayerSpawns[2][3] = {
{2297.1064,2452.0115,10.8203},
{2297.0452,2468.6743,10.8203}
};
Re: [HELP] Admin command!!!! Somebody help me. Thanks -
Grim_ - 09.04.2010
I don't get what you're saying, but try changing this
pawn Код:
Spec[playerid][Spectating] = false;
return SendClientMessage(playerid,yellow,"You have turned your spectator mode off.");
to this
pawn Код:
Spec[playerid][Spectating] = false;
SendClientMessage(playerid,yellow,"You have turned your spectator mode off.");
return 1;
Please explain what you actually mean, bc I don't understand what you're saying.
Re: [HELP] Admin command!!!! Somebody help me. Thanks -
BlackSkull - 09.04.2010
Is so kind I use to watch the spec player then when I exit the observer if I am with guns and I lose money and go back to my position on the respawn, as I said above or lose my arms, my current position and cash so I want to repair it because it gets bad lost all that and not getting to.
Re: [HELP] Admin command!!!! Somebody help me. Thanks -
Naxix - 09.04.2010
I think you might need to save the money, weapons, etc into a file and than load it from there.
Re: [HELP] Admin command!!!! Somebody help me. Thanks -
M4S7ERMIND - 09.04.2010
You dont need to save all that to file. You need a few variables to save the data:
pawn Код:
enum sdata
{
Float:posx,
Float:posy,
Float:posz,
sinterior,
smoney
}
new LastData[MAX_PLAYERS][sdata],
WeapData[MAX_PLAYERS][2][13];
Copy the code below and paste it before
TogglePlayerSpectating(playerid, true); in
/spec command.
pawn Код:
for(new i; i < 13; i++) GetPlayerWeaponData(playerid, i, WeapData[playerid][0][i], WeapData[playerid][1][i]);
GetPlayerPos(playerid, LastData[playerid][posx], LastData[playerid][posy], LastData[playerid][posz]);
GetPlayerInterior(playerid, LastData[playerid][sinterior]);
GetPlayerMoney(playerid, , LastData[playerid][smoney]);
Remove
Spec[playerid][Spectating] = false; from
/spec off and paste the code below
OnPlayerSpawn.
pawn Код:
public OnPlayerSpawn(playerid)
{
if(Spec[playerid][Spectating])
{
for(new i; i < 13; i++) GivePlayerWeapon(playerid, WeapData[playerid][0][i], WeapData[playerid][1][i]);
SetPlayerPos(playerid, LastData[playerid][posx], LastData[playerid][posy], LastData[playerid][posz]);
SetPlayerInterior(playerid, LastData[playerid][sinterior]);
SetPlayerMoney(playerid, LastData[playerid][smoney]); //the money received during spectate wont be given here.
Spec[playerid][Spectating] = false;
}
return 1;
}
You might also want to set
Spec[playerid][Spectating] = false; OnPlayerDisconnect. Have fun!
Re: [HELP] Admin command!!!! Somebody help me. Thanks -
BlackSkull - 09.04.2010
Thank you for helping me Mастерминд.
================================================== ==========================================||
2 errors occurred:
Код:
D:\SA-MP\SA-MP (R7)\filterscripts\Admin.pwn(1146) : warning 202: number of arguments does not match definition
D:\SA-MP\SA-MP (R7)\filterscripts\Admin.pwn(1147) : warning 202: number of arguments does not match definition
Lines with errors:
Код:
GetPlayerInterior(playerid, LastData[playerid][sinterior]);
GetPlayerMoney(playerid, LastData[playerid][smoney]);
================================================== ===========================================||
Here's how it was:
Код:
dcmd_spec(playerid,params[]) {
if(IsPlayerCommandLevel(playerid,"spec")) {
if(!strlen(params)) return SendClientMessage(playerid,red,"[ERROR]: \"/SPEC <NICK OR ID | OFF>\".");
new id;
if(!IsNumeric(params)) {
if(!strcmp(params,"off",true)) {
if(!Spec[playerid][Spectating]) return SendClientMessage(playerid,red,"[ERROR]: You should be watchful.");
SendCommandMessageToAdmins(playerid,"SPEC OFF");
TogglePlayerSpectating(playerid,false);
Spec[playerid][Spectating] = false;
return SendClientMessage(playerid,yellow,"You left the observer mode.");
}
id = ReturnPlayerID(params);
}
else id = strval(params);
if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID && id != playerid) {
SendCommandMessageToAdmins(playerid,"SPEC");
new string[256],name[24]; GetPlayerName(id,name,24);
if(Spec[id][Spectating]) return SendClientMessage(playerid,red,"Error: You may not notice a player ever observed.");
if(Spec[playerid][Spectating] && Spec[playerid][SpectateID] == id) return SendClientMessage(playerid,red,"[ERROR]:You're already watching this player.");
Spec[playerid][Spectating] = true, Spec[playerid][SpectateID] = id;
SetPlayerInterior(playerid,GetPlayerInterior(id));
for(new i; i < 13; i++) GetPlayerWeaponData(playerid, i, WeapData[playerid][0][i], WeapData[playerid][1][i]);
GetPlayerPos(playerid, LastData[playerid][posx], LastData[playerid][posy], LastData[playerid][posz]);
GetPlayerInterior(playerid, LastData[playerid][sinterior]); //ERROR
GetPlayerMoney(playerid, LastData[playerid][smoney]); //ERROR
TogglePlayerSpectating(playerid,true);
if(!IsPlayerInAnyVehicle(id)) PlayerSpectatePlayer(playerid,id);
else PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));
format(string,256,"You are now watching the player \"%s\".",name); return SendClientMessage(playerid,yellow,string);
} else return SendClientMessage(playerid,red,"[ERROR]: You may not notice yourself or a disconnected player.");
} else return SendLevelErrorMessage(playerid,"spec");
}
OnPlayerSpawn:
Код:
public OnPlayerSpawn(playerid)
{
if(Spec[playerid][Spectating])
{
for(new i; i < 13; i++) GivePlayerWeapon(playerid, WeapData[playerid][0][i], WeapData[playerid][1][i]);
SetPlayerPos(playerid, LastData[playerid][posx], LastData[playerid][posy], LastData[playerid][posz]);
SetPlayerInterior(playerid, LastData[playerid][sinterior]);
SetPlayerMoney(playerid, LastData[playerid][smoney]); //the money received during spectate wont be given here.
Spec[playerid][Spectating] = false;
if(Variables[playerid][Jailed]) { SetPlayerInterior(playerid,3); SetPlayerPos(playerid,197.6661,173.8179,1003.0234); SetPlayerFacingAngle(playerid,0); }
}
return 1;
}
Re: [HELP] Admin command!!!! Somebody help me. Thanks -
M4S7ERMIND - 09.04.2010
My bad, it suppose to be like this:
Код:
LastData[playerid][sinterior] = GetPlayerInterior(playerid);
LastData[playerid][smoney] = GetPlayerMoney(playerid);
EDIT: You'll need to remove
Spec[playerid][Spectating] = false; from
/spec off in order this to work.
OnPlayerSpawn should probably be like this:
pawn Код:
public OnPlayerSpawn(playerid)
{
if(Spec[playerid][Spectating])
{
for(new i; i < 13; i++) GivePlayerWeapon(playerid, WeapData[playerid][0][i], WeapData[playerid][1][i]);
SetPlayerPos(playerid, LastData[playerid][posx], LastData[playerid][posy], LastData[playerid][posz]);
SetPlayerInterior(playerid, LastData[playerid][sinterior]);
SetPlayerMoney(playerid, LastData[playerid][smoney]); //the money received during spectate wont be given here.
Spec[playerid][Spectating] = false;
}
if(Variables[playerid][Jailed]) { SetPlayerInterior(playerid,3); SetPlayerPos(playerid,197.6661,173.8179,1003.0234); SetPlayerFacingAngle(playerid,0); }
return 1;
}
Re: [HELP] Admin command!!!! Somebody help me. Thanks -
BlackSkull - 09.04.2010
Now compile, more ta same thing as before no ta saving positions, weapons, and money, I do not know how to resolve this problema.Mais Thanks for the help and willingness to help me.
It was so:
Код:
dcmd_spec(playerid,params[]) {
if(IsPlayerCommandLevel(playerid,"spec")) {
if(!strlen(params)) return SendClientMessage(playerid,red,"[ERROR]: \"/SPEC <NICK OR ID | OFF>\".");
new id;
if(!IsNumeric(params)) {
if(!strcmp(params,"off",true)) {
if(!Spec[playerid][Spectating]) return SendClientMessage(playerid,red,"[ERROR]: You should be watchful.");
SendCommandMessageToAdmins(playerid,"SPEC OFF");
TogglePlayerSpectating(playerid,false);
Spec[playerid][Spectating] = false;
return SendClientMessage(playerid,yellow,"You left the observer mode.");
}
id = ReturnPlayerID(params);
}
else id = strval(params);
if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID && id != playerid) {
SendCommandMessageToAdmins(playerid,"SPEC");
new string[256],name[24]; GetPlayerName(id,name,24);
if(Spec[id][Spectating]) return SendClientMessage(playerid,red,"Error: You may not notice a player ever observed.");
if(Spec[playerid][Spectating] && Spec[playerid][SpectateID] == id) return SendClientMessage(playerid,red,"[ERROR]:You're already watching this player.");
Spec[playerid][Spectating] = true, Spec[playerid][SpectateID] = id;
SetPlayerInterior(playerid,GetPlayerInterior(id));
for(new i; i < 13; i++) GetPlayerWeaponData(playerid, i, WeapData[playerid][0][i], WeapData[playerid][1][i]);
GetPlayerPos(playerid, LastData[playerid][posx], LastData[playerid][posy], LastData[playerid][posz]);
LastData[playerid][sinterior] = GetPlayerInterior(playerid);
LastData[playerid][smoney] = GetPlayerMoney(playerid);
TogglePlayerSpectating(playerid,true);
if(!IsPlayerInAnyVehicle(id)) PlayerSpectatePlayer(playerid,id);
else PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));
format(string,256,"You are now watching the player \"%s\".",name); return SendClientMessage(playerid,yellow,string);
} else return SendClientMessage(playerid,red,"[ERROR]: You may not notice yourself or a disconnected player.");
} else return SendLevelErrorMessage(playerid,"spec");
}
Thanks anyway Mастерминд
Re: [HELP] Admin command!!!! Somebody help me. Thanks -
M4S7ERMIND - 09.04.2010
Replace your
/spec off with this:
pawn Код:
if(!strcmp(params,"off",true))
{
if(!Spec[playerid][Spectating]) return SendClientMessage(playerid,red,"[ERROR]: You should be watchful."); //wtf?
SendCommandMessageToAdmins(playerid,"SPEC OFF");
TogglePlayerSpectating(playerid, false);
return SendClientMessage(playerid,yellow,"You left the observer mode.");
}
And move
SetPlayerInterior(playerid, GetPlayerInterior(id)); below
TogglePlayerSpectating(playerid, true);
Re: [HELP] Admin command!!!! Somebody help me. Thanks -
BlackSkull - 09.04.2010
Thank you to help put the way you speak no more ta working, compiles more stays the same. Thanks and sorry to disturb too much.
It was therefore:
//On top FS
Код:
enum sdata
{
Float:posx,
Float:posy,
Float:posz,
sinterior,
smoney
}
new LastData[MAX_PLAYERS][sdata],WeapData[MAX_PLAYERS][2][13];
OnPlayerSpawn FS
Код:
public OnPlayerSpawn(playerid)
{
if(Spec[playerid][Spectating])
{
for(new i; i < 13; i++) GivePlayerWeapon(playerid, WeapData[playerid][0][i], WeapData[playerid][1][i]);
SetPlayerPos(playerid, LastData[playerid][posx], LastData[playerid][posy], LastData[playerid][posz]);
SetPlayerInterior(playerid, LastData[playerid][sinterior]);
SetPlayerMoney(playerid, LastData[playerid][smoney]); //the money received during spectate wont be given here.
Spec[playerid][Spectating] = false;
}
if(Variables[playerid][Jailed]) { SetPlayerInterior(playerid,3); SetPlayerPos(playerid,197.6661,173.8179,1003.0234); SetPlayerFacingAngle(playerid,0); }
return 1;
}
Command spec:
Код:
dcmd_spec(playerid,params[]) {
if(IsPlayerCommandLevel(playerid,"spec")) {
if(!strlen(params)) return SendClientMessage(playerid,red,""[ERROR]: \"/SPEC <NICK OR ID | OFF>\".");
new id;
if(!IsNumeric(params)) {
if(!strcmp(params,"off",true)) {
if(!Spec[playerid][Spectating]) return SendClientMessage(playerid,red,"[ERROR]: You should be watchful.");
SendCommandMessageToAdmins(playerid,"SPEC OFF");
TogglePlayerSpectating(playerid, false);
return SendClientMessage(playerid,yellow,"You left the observer mode.");
}
id = ReturnPlayerID(params);
}
else id = strval(params);
if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID && id != playerid) {
SendCommandMessageToAdmins(playerid,"SPEC");
new string[256],name[24]; GetPlayerName(id,name,24);
if(Spec[id][Spectating]) return SendClientMessage(playerid,red,"Error: You may not notice a player ever observed.");
if(Spec[playerid][Spectating] && Spec[playerid][SpectateID] == id) return SendClientMessage(playerid,red,"[ERROR]:You're already watching this player.");
Spec[playerid][Spectating] = true, Spec[playerid][SpectateID] = id;
for(new i; i < 13; i++) GetPlayerWeaponData(playerid, i, WeapData[playerid][0][i], WeapData[playerid][1][i]);
GetPlayerPos(playerid, LastData[playerid][posx], LastData[playerid][posy], LastData[playerid][posz]);
LastData[playerid][sinterior] = GetPlayerInterior(playerid);
LastData[playerid][smoney] = GetPlayerMoney(playerid);
TogglePlayerSpectating(playerid,true);
SetPlayerInterior(playerid, GetPlayerInterior(id));
if(!IsPlayerInAnyVehicle(id)) PlayerSpectatePlayer(playerid,id);
else PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));
format(string,256,"You are now watching the player \"%s\".",name); return SendClientMessage(playerid,yellow,string);
} else return SendClientMessage(playerid,red,"[ERROR]: You may not notice yourself or a disconnected player.");
} else return SendLevelErrorMessage(playerid,"spec");
}