SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Closed Thread
 
Thread Tools Display Modes
Old 24/12/2008, 12:52 AM   #861
domidom
Big Clucker
 
Join Date: Feb 2007
Posts: 177
Reputation: 15
Default Re: Useful Commands

Quote:
Originally Posted by JaTochNietDan
Quote:
Originally Posted by Simon
This:
format(string,sizeof(string),"~r~%d",Count");

Should be:
format(string,sizeof(string),"~r~%d",Count);

You don't need the playerid parameter either - you never use it.
Oops, good point Simon
Your countdown will also always return the 'Already in progress' message, because Count is almost always greater than 0.
domidom is offline  
Old 24/12/2008, 11:59 PM   #862
JaTochNietDan
High-roller
 
JaTochNietDan's Avatar
 
Join Date: Apr 2007
Location: Republic of Ireland
Posts: 2,502
Reputation: 363
Default Re: Useful Commands

Quote:
Originally Posted by DragSta
Quote:
Originally Posted by JaTochNietDan
Quote:
Originally Posted by Simon
This:
format(string,sizeof(string),"~r~%d",Count");

Should be:
format(string,sizeof(string),"~r~%d",Count);

You don't need the playerid parameter either - you never use it.
Oops, good point Simon
Your countdown will also always return the 'Already in progress' message, because Count is almost always greater than 0.
Fixed, god damn what a fail
__________________
Releases:
[Includes]: [jBan] | [jBanLite]
[Plugins]: [FileManager] | [Execute]
[Applications]: [Remote Administrator *NEW] | [Script King] | [RCON GUI]
JaTochNietDan is offline  
Old 02/01/2009, 05:15 PM   #863
AlExAlExAlEx
Huge Clucker
 
Join Date: Nov 2008
Posts: 212
Reputation: 5
Default Re: Useful Commands

Quote:
Originally Posted by [Fackin'
Luke ]
/vnp
By [Fackin']Luke.

pawn Code:
if(strcmp(cmd,"/vnp",true)==0)
{
  new tmp[256];
  new vehicleid = GetPlayerVehicleID(playerid);
     
  if(GetPlayerState(playerid) != 2)
  {
    SendClientMessage(playerid,COLOR_YELLOW,"You must be the driver of a Vehicle to change the Number Plate.");
    return 1;
  }
     
  if(IsPlayerInVehicleWithNoPlates(playerid,vehicleid))
  {
    SendClientMessage(playerid,COLOR_YELLOW,"Your vehicle does not have a Number Plate.");
    return 1;
  }
       
  tmp = strtok(cmdtext, idx);
  if(!strlen(tmp))
  {
    SendClientMessage(playerid,COLOR_YELLOW,"USAGE: /vnp [number plate text]");
    SendClientMessage(playerid,COLOR_YELLOW,"NOTE: To put one or more Spaces, you must put an _ (Underslash)");
    return 1;
  }
   
  if(strlen(tmp)<0 || strlen(tmp)>8)
  {
    SendClientMessage(playerid,COLOR_YELLOW,"Number Plates can only be 1-8 characters long!");
    return 1;
  }
  else
  {
    GetVehiclePos(vehicleid,VPos[0],VPos[1],VPos[2]);
    GetVehicleZAngle(vehicleid,VPos[3]);
    SetVehicleNumberPlate(vehicleid,tmp);
    RemovePlayerFromVehicle(playerid);
    TogglePlayerControllable(playerid,false);
    SetVehicleToRespawn(vehicleid);
    gPlayerVehicle[playerid] = vehicleid;
    SetTimerEx("VehicleTimer",700,0,"i",playerid);
    SendClientMessage(playerid,COLOR_YELLOW,"There will be a very short delay while your Vehicles Number Plate is set.");
    return 1;
  }
}

Requires:

IsPlayerInVehicleWithNoPlates(playerid,vehicleid) - By [Fackin']Luke.
strtok
pawn Code:
//above main() or OnFilterScriptInit:
#define COLOR_YELLOW 0xFFFF00AA
new gPlayerVehicle[MAX_PLAYERS];
new Float:VPos[4];
forward VehicleTimer(playerid);

//before all of your commands in OnPlayerCommandText:
new cmd[256],idx;
cmd = strtok(cmdtext,idx);

//anywhere on your script thats not inside another function/callback:
public VehicleTimer(playerid)
{
  SetVehiclePos(gPlayerVehicle[playerid],VPos[0],VPos[1],VPos[2]);
  SetVehicleZAngle(gPlayerVehicle[playerid],VPos[3]);
  PutPlayerInVehicle(playerid,gPlayerVehicle[playerid],0);
  TogglePlayerControllable(playerid,true);
}

NOTE: Do not remove the IsPlayerInVehicleWithNoPlates check near the start of the command or you will have a /vnp command which will work no matter which vehicle you are in, which may cause crashes on vehicles like planes, boats, etc.

Known Issues:
Some vehicles with number plates don't let you change the number plate.
Sometimes you might have to do the command more than once for it to work.

I have been meaning to post this on here for quite some time now, but haven't got around to it until now. :P

If you use my /vnp command on your script then I would appreciate any credit given, Enjoy!

EDIT: Added the forward for the VehicleTimer to the code part of "Requires".
Vnp is working onl for you or for alls?(sync bug)
AlExAlExAlEx is offline  
Old 10/01/2009, 11:35 PM   #864
NeptoZ
Little Clucker
 
Join Date: Jul 2007
Posts: 10
Reputation: 0
Default Re: Useful Commands

Get Car ID from your current Vehicle
Code:
  if(strcmp(cmdtext, "/carid", true) == 0)
  {
	if(IsPlayerInAnyVehicle(playerid)) {
    new string[128];
    format(string, sizeof(string), "Car ID: %d",GetPlayerVehicleID(playerid));
    SendClientMessage(playerid, 0xB360FDFF, string);
    }
    else {
    SendClientMessage(playerid,0xAA3333AA,"You're not in a vehicle");
    }
  }
Repair your current vehicle
Code:
	new currentveh;
	currentveh = GetPlayerVehicleID(playerid);  
if(strcmp(cmdtext, "/repair", true) == 0)
  {
    if(IsPlayerInAnyVehicle(playerid)) {
    SetVehicleHealth(currentveh,1000.0);
    GameTextForPlayer(playerid,"~g~Vehicle repaired!",3000,3);
    SendClientMessage(playerid,0x21DD00FF,"Vehicle repaired!");
    PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
    }
    else {
    SendClientMessage(playerid,0xAA3333AA,"You're not in a vehicle");
    return 1;
    }
  }
Despawn/destroy your current vehicle
Code:
  	new currentveh;
	currentveh = GetPlayerVehicleID(playerid);  
if(strcmp(cmdtext, "/despawn", true) == 0)
  {
		 if(IsPlayerInAnyVehicle(playerid)) {
     DestroyVehicle(currentveh);
     SendClientMessage(playerid, 0xAA3333AA, "Vehicle despawned(destroyed)");
     GameTextForPlayer(playerid,"~r~Vehicle despawned~n~(destroyed)",3000,3);
     PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
     }
     else {
     SendClientMessage(playerid,0xAA3333AA,"You're not in a vehicle");
     return 1;
     }
  }
Respawn your current vehicle
Code:
      	new currentveh;
	currentveh = GetPlayerVehicleID(playerid);  
if(strcmp(cmdtext, "/respawn", true) == 0)
  {
		 if(IsPlayerInAnyVehicle(playerid)) {
     SetVehicleToRespawn(currentveh);
     SendClientMessage(playerid, COLOR_GREEN, "Vehicle respawned!");
     GameTextForPlayer(playerid,"~g~Vehicle respawned!",2000,3);
     PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
     }
     else {
     SendClientMessage(playerid,COLOR_RED,"You're not in a vehicle");
     return 1;
     }
  }
Will add hydraulics to your current vehicle
Code:
    	new currentveh;
	currentveh = GetPlayerVehicleID(playerid);  
if(strcmp(cmdtext, "/hydraulics", true) == 0)
  {
		 if(IsPlayerInAnyVehicle(playerid)) {
     AddVehicleComponent(currentveh,1087);
     GameTextForPlayer(playerid,"~w~Vehicle modded with:~g~ Hydraulics",3000,3);
     PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
     }
     else {
     SendClientMessage(playerid,0xAA3333AA,"You're not in a vehicle");
     }
  }
Add 10 x nitro to your current vehicle
Code:
      	new currentveh;
	currentveh = GetPlayerVehicleID(playerid);  
if(strcmp(cmdtext, "/nitro x10", true) == 0)
  {
		 if(IsPlayerInAnyVehicle(playerid)) {
     SendClientMessage(playerid,0x21DD00FF,"You got 10x Nitro added to your vehicle");
     GameTextForPlayer(playerid,"~w~Vehicle modded with:~g~ x10 Nitro",3000,3);
     AddVehicleComponent(currentveh, 1010);
     PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
     }
     else {
     SendClientMessage(playerid,0xAA3333AA,"You're not in a vehicle");
     }
  }
Get yourself a Jetpack
Code:
  if(strcmp(cmdtext, "/jetpack", true) == 0)
  {
		if(IsPlayerAdmin(playerid)) {
		SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK);
		SendClientMessage(playerid,0x21DD00FF,"You got a jetpack");
    }
  }
Heal yourself and get armour
Code:
  if(strcmp(cmdtext, "/heal", true) == 0)
  {
    SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid, 100);
    GameTextForPlayer(playerid,"~g~Healed!",2000,3);
    SendClientMessage(playerid, 0x21DD00FF, "You've been healed!");
  }
Give yourself 1.000.000$
Code:
  if(strcmp(cmdtext, "/money", true) == 0)
  {
    GivePlayerMoney(playerid,1000000);
    GameTextForPlayer(playerid,"~r~You got:~w~ 1.000.000$",3000,3);
    SendClientMessage(playerid, 0x21DD00FF, "You got: 1.000.000$");
    PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
  }
NeptoZ is offline  
Old 14/01/2009, 03:10 AM   #865
Tito_Johnson
Little Clucker
 
Join Date: Aug 2008
Posts: 28
Reputation: 0
Default Re: Useful Commands

Quote:
Originally Posted by Andre9977
/vm (Vehicle Message)
Send message to people in Your car, might come useful for RPs

Deleted the Code So It Looked Smoother
I've been using this script, it works good, except for one thing. I had to delete
pawn Code:
new string[256];
new sendername[MAX_PLAYER_NAME];
for it to work. Now every so often my game crashes. Maybe its the spawn point I'm using but I highly believe its the script. Any ideas on how to fix that?
Tito_Johnson is offline  
Old 20/01/2009, 02:15 PM   #866
Jaztek_Hodzic
Big Clucker
 
Join Date: Nov 2008
Posts: 89
Reputation: 0
Default Re: Useful Commands

the carid one is pretty useful mite try it out .
Jaztek_Hodzic is offline  
Old 28/01/2009, 11:29 AM   #867
ReFuSeR
Big Clucker
 
Join Date: Apr 2008
Posts: 76
Reputation: 2
Default Re: Useful Commands

I believe it is impossible but I will shoot this question out there instead of posting annoying topics....


Is it possible to make a command which makes your body invisible to other players yet... you can see all players?


This would be nice fore admin spying but... there is spectating.

I thought of changing virtual worlds and that little... change the interior when in a vehicle but it was useless... you can still hear the vehicles noise and see the cars moments
__________________
Sprunk Guard Detection: Click this
ReFuSeR is offline  
Old 28/01/2009, 01:20 PM   #868
[WS]Hyper
Huge Clucker
 
Join Date: Sep 2008
Posts: 314
Reputation: 0
Default Re: Useful Commands

I don't think it's possible. The best you can do is as you said with the car virtual world bug thing, but that's not great. Other than that I think you should just use spectae :/
[WS]Hyper is offline  
Old 29/01/2009, 12:01 PM   #869
MenaceX^
High-roller
 
Join Date: Aug 2008
Posts: 3,262
Reputation: 13
Default Re: Useful Commands

Useful command for GF or who ever has Warn system.
pawn Code:
if(!strcmp(cmd,"/setwarn",true))
    {
         if(PlayerInfo[playerid][pAdmin]<1336)
        return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command.");
            cmd = strtok(cmdtext, idx);
            if(!strlen(cmd)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setwarn [playername/id] [warning]");
            new id = ReturnUser(tmp);
            if(!IsPlayerConnected(id))
      return SendClientMessage(playerid, COLOR_GREY, "Invalid Player ID.");
            GetPlayerName(id, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            tmp = strtok(cmdtext, idx);
            new warns = strval(tmp);
            if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setwarn [playername/id] [warnings]");
            PlayerInfo[id][pWarns] = warns;
            format(string, sizeof(string), "Admin %s has changed your warns ammount to : %d", sendername, warns);
            SendClientMessage(id, COLOR_GREY, string);
            format(string, sizeof(string), "%s has set %s's warnings to %d",sendername,giveplayer, PlayerInfo[id][pWarns]);
      ABroadCast(COLOR_LIGHTRED,string,1);
      return 1;
      }
MenaceX^ is offline  
Old 29/01/2009, 12:09 PM   #870
MenaceX^
High-roller
 
Join Date: Aug 2008
Posts: 3,262
Reputation: 13
Default Re: Useful Commands

pawn Code:
if(!strcmp(cmd,"/setwarn",true))
    {
    if(PlayerInfo[playerid][pAdmin]<1336)
       return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command.");
    cmd = strtok(cmdtext, idx);
    if(!strlen(cmd)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setwarn [playername/id] [warning]");
    new id = ReturnUser(tmp);
    if(!IsPlayerConnected(id))
      return SendClientMessage(playerid, COLOR_GREY, "Invalid Player ID.");
    GetPlayerName(id, giveplayer, sizeof(giveplayer));
    GetPlayerName(playerid, sendername, sizeof(sendername));
    tmp = strtok(cmdtext, idx);
    new warns = strval(tmp);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setwarn [playername/id] [warnings]");
    PlayerInfo[id][pWarns] = warns;
    format(string, sizeof(string), "Admin %s has changed your warns ammount to : %d", sendername, warns);
    SendClientMessage(id, COLOR_GREY, string);
    format(string, sizeof(string), "%s has set %s's warnings to %d",sendername,giveplayer, PlayerInfo[id][pWarns]);
    ABroadCast(COLOR_LIGHTRED,string,1);
    if(PlayerInfo[id][pWarns] == 3)
    Ban(id);
    format(string, sizeof(string), "%s was autobanned because he has 3 warnings.", giveplayer);
    SendClientMessageToAll(COLOR_LIGHTRED,string);
    return 1;
    }
MenaceX^ is offline  
Closed Thread

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
Commands abineri Help Archive 5 19/03/2010 01:24 PM
DCMD Commands not working after adding some ZCMD commands :S [L3th4l] Help Archive 4 20/01/2010 10:57 PM
[Help] Some commands cigo Help Archive 2 09/06/2009 08:01 PM
::Need cop commands Can anybody help? :: Battlaman Help Archive 4 22/02/2009 10:08 PM


All times are GMT. The time now is 11:35 AM.


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