SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 11/09/2009, 12:09 AM   #1
Lia
Little Clucker
 
Join Date: Sep 2009
Posts: 29
Reputation: 0
Default I cannot get my /spec working..

Im trying to add /spec... that i got.. and it wont work.. the server has a built in /spec... but.. it wont work..
So.?? Any one has a /spec command i can try?
Lia is offline  
Old 11/09/2009, 12:28 AM   #2
Jason_Borne420
Big Clucker
 
Join Date: Feb 2008
Posts: 57
Reputation: 0
Default Re: I cannot get my /spec working..

if you use strval you can do it like this:

Code:
if(strcmp(cmd,"/spec",true)==0)
	{
  if(PlayerAdminLevel[playerid] != 1337) {
  SendClientMessage(playerid, COLOR_ERROR, "Only Admins can use this command");
  return 1;
  }
  tmp = strtok(cmdtext, idx);
  if(!strlen(tmp)) {
  SendClientMessage(playerid, COLOR_ERROR, "USAGE: /spec (id)");
  return 1;
  }
  if(!IsNumeric(tmp)) {
  SendClientMessage(playerid, COLOR_ERROR, "USAGE: /spec (id) ID Must be a number");
  return 1;
  }
  if(strval(tmp) == playerid) {
  SendClientMessage(playerid, COLOR_ERROR, "You cannot spec yourself!");
  return 1;
  }
  giveplayerid = strval(tmp);
  if(!IsPlayerConnected(giveplayerid)) {
  format(string, sizeof(string), "ID (%d) Is not an active player",giveplayerid);
  SendClientMessage(playerid, COLOR_ERROR, string);
  return 1;
  }
	IsSpawned[playerid] =1;
	TogglePlayerSpectating(playerid, 1);
  SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(giveplayerid));
  SetPlayerInterior(playerid,GetPlayerInterior(giveplayerid));
	if (IsPlayerInAnyVehicle(giveplayerid)) PlayerSpectateVehicle(playerid, GetPlayerVehicleID(giveplayerid));
	else PlayerSpectatePlayer(playerid, giveplayerid);
	IsSpawned[playerid] = 1;
	return 1;
	}
Jason_Borne420 is offline  
Old 11/09/2009, 12:36 AM   #3
Lia
Little Clucker
 
Join Date: Sep 2009
Posts: 29
Reputation: 0
Default Re: I cannot get my /spec working..

Quote:
Originally Posted by Jason_Borne420
if you use strval you can do it like this:

Code:
if(strcmp(cmd,"/spec",true)==0)
	{
  if(PlayerAdminLevel[playerid] != 1337) {
  SendClientMessage(playerid, COLOR_ERROR, "Only Admins can use this command");
  return 1;
  }
  tmp = strtok(cmdtext, idx);
  if(!strlen(tmp)) {
  SendClientMessage(playerid, COLOR_ERROR, "USAGE: /spec (id)");
  return 1;
  }
  if(!IsNumeric(tmp)) {
  SendClientMessage(playerid, COLOR_ERROR, "USAGE: /spec (id) ID Must be a number");
  return 1;
  }
  if(strval(tmp) == playerid) {
  SendClientMessage(playerid, COLOR_ERROR, "You cannot spec yourself!");
  return 1;
  }
  giveplayerid = strval(tmp);
  if(!IsPlayerConnected(giveplayerid)) {
  format(string, sizeof(string), "ID (%d) Is not an active player",giveplayerid);
  SendClientMessage(playerid, COLOR_ERROR, string);
  return 1;
  }
	IsSpawned[playerid] =1;
	TogglePlayerSpectating(playerid, 1);
  SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(giveplayerid));
  SetPlayerInterior(playerid,GetPlayerInterior(giveplayerid));
	if (IsPlayerInAnyVehicle(giveplayerid)) PlayerSpectateVehicle(playerid, GetPlayerVehicleID(giveplayerid));
	else PlayerSpectatePlayer(playerid, giveplayerid);
	IsSpawned[playerid] = 1;
	return 1;
	}
Tried. wont work............ Im using the gamemode.. West Coast Roleplay that is SOPOSE.. to have a spec.. but the spec does not work.. and thanks for help tho,
Lia is offline  
Old 11/09/2009, 12:51 AM   #4
Anwix
Big Clucker
 
Anwix's Avatar
 
Join Date: Jun 2007
Posts: 130
Reputation: 0
Default Re: I cannot get my /spec working..

Login to RCON, type /rcon loadfs adminspec, type /specplayer [playerid] and /specoff to stop.

All servers come with AdminSpec i think **
Anwix is offline  
Old 19/10/2009, 02:41 AM   #5
Jason_Borne420
Big Clucker
 
Join Date: Feb 2008
Posts: 57
Reputation: 0
Default Re: I cannot get my /spec working..

It does work fine. You just need to learn to edit the script. I figured you could figure it out but apparently not, even with the whole command given.

remove the if(playeradminlevel[playerid] != 1337)


and the other variable[playerid] that you dont use.
Jason_Borne420 is offline  
Old 20/10/2009, 09:24 PM   #6
Lia
Little Clucker
 
Join Date: Sep 2009
Posts: 29
Reputation: 0
Default Re: I cannot get my /spec working..

Confused :/
Lia is offline  
Old 20/10/2009, 09:35 PM   #7
kman
Big Clucker
 
Join Date: Sep 2009
Posts: 145
Reputation: 0
Default Re: I cannot get my /spec working..

/spec doesnt work on lvrcr gm and it probably doesnt work on westcoast roleplay either
kman is offline  
Old 22/10/2009, 01:50 AM   #8
Jason_Borne420
Big Clucker
 
Join Date: Feb 2008
Posts: 57
Reputation: 0
Default Re: I cannot get my /spec working..

Quote:
Originally Posted by kman
/spec doesnt work on lvrcr gm and it probably doesnt work on westcoast roleplay either
Wrong.


Here is one that works perfect for lvrcr gm - but does work for anyone.


Add this under OnPlayerCommandText

Code:
if(strcmp(cmd,"/spec",true)==0)
  tmp = strtok(cmdtext, idx);
  if(!strlen(tmp)) {
  SendClientMessage(playerid, COLOR_ERROR, "USAGE: /spec (id)");
  return 1;
  }
  if(!IsNumeric(tmp)) {
  SendClientMessage(playerid, COLOR_ERROR, "USAGE: /spec (id) ID Must be a number");
  return 1;
  }
  if(strval(tmp) == playerid) {
  SendClientMessage(playerid, COLOR_ERROR, "You cannot spec yourself!");
  return 1;
  }
  giveplayerid = strval(tmp);
  if(!IsPlayerConnected(giveplayerid)) {
  format(string, sizeof(string), "ID (%d) Is not an active player",giveplayerid);
  SendClientMessage(playerid, COLOR_ERROR, string);
  return 1;
  }
	TogglePlayerSpectating(playerid, 1);
  SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(giveplayerid));
  SetPlayerInterior(playerid,GetPlayerInterior(giveplayerid));
	if (IsPlayerInAnyVehicle(giveplayerid)) PlayerSpectateVehicle(playerid, GetPlayerVehicleID(giveplayerid));
	else PlayerSpectatePlayer(playerid, giveplayerid);
	return 1;
	}
Jason_Borne420 is offline  
Old 22/10/2009, 02:12 AM   #9
Lia
Little Clucker
 
Join Date: Sep 2009
Posts: 29
Reputation: 0
Default Re: I cannot get my /spec working..

Copied that, put it in pawno, Pawno Libary shut down
Lia is offline  
Old 22/10/2009, 03:40 AM   #10
Jason_Borne420
Big Clucker
 
Join Date: Feb 2008
Posts: 57
Reputation: 0
Default Re: I cannot get my /spec working..

Im sorry, i forgot a bracket, try this


Code:
if(strcmp(cmd,"/spec",true)==0)
{
  tmp = strtok(cmdtext, idx);
  if(!strlen(tmp)) {
  SendClientMessage(playerid, COLOR_ERROR, "USAGE: /spec (id)");
  return 1;
  }
  if(!IsNumeric(tmp)) {
  SendClientMessage(playerid, COLOR_ERROR, "USAGE: /spec (id) ID Must be a number");
  return 1;
  }
  if(strval(tmp) == playerid) {
  SendClientMessage(playerid, COLOR_ERROR, "You cannot spec yourself!");
  return 1;
  }
  giveplayerid = strval(tmp);
  if(!IsPlayerConnected(giveplayerid)) {
  format(string, sizeof(string), "ID (%d) Is not an active player",giveplayerid);
  SendClientMessage(playerid, COLOR_ERROR, string);
  return 1;
  }
	TogglePlayerSpectating(playerid, 1);
  SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(giveplayerid));
  SetPlayerInterior(playerid,GetPlayerInterior(giveplayerid));
	if (IsPlayerInAnyVehicle(giveplayerid)) PlayerSpectateVehicle(playerid, GetPlayerVehicleID(giveplayerid));
	else PlayerSpectatePlayer(playerid, giveplayerid);
	return 1;
	}
Jason_Borne420 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/spec help. ownboy Help Archive 4 24/02/2010 09:14 AM
/spec? Lia Help Archive 2 06/09/2009 05:17 PM
Spec cloud9 Help Archive 1 09/08/2009 02:23 AM
Set a spec? matdav Help Archive 1 01/08/2009 07:27 PM


All times are GMT. The time now is 07:38 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.