Help with Nanites
#1

Would someone able to help me with my . Under the comment line [tele to player/tele player to you] I wanted a cmd that teleports the user to a player, and another one that teleport a select player to the user i have search all over and cant find any tut on this any help would be appreciated, also this maybe asking too much but does anyone know how to make it so only players that I give nanite rights to can use the cmds, Thanks in advacne Alastair
Reply
#2

Код:
OnPlayerCommandText(playerid, cmdtext[])
{
  dcmd(get, 3, cmdtext);
  dcmd(goto, 4, cmdtext);
  return 1;
}

dcmd_get(playerid, params[])
{
  if(!strlen(params)){
    SendClientMessage(playerid, COLOR, "/get [id]");
  }else{
    new pid = strval(params);
    if(IsPlayerConnected(pid)){
      new Float:x, Float:y, Float:z;
      GetPlayerPos(playerid, x, y, z);
      SetPlayerPos(pid, x+1, y+1, z);
    }else{
      SendClientMessage(playerid, COLOR, "Player is not connected");
    }
  }
  return 1;
}

dcmd_goto(playerid, params[])
{
  if(!strlen(params)){
    SendClientMessage(playerid, COLOR, "/goto [id]");
  }else{
    new pid = strval(params);
    if(IsPlayerConnected(pid)){
      new Float:x, Float:y, Float:z;
      GetPlayerPos(pid, x, y, z);
      SetPlayerPos(playerid, x+1, y+1, z);
    }else{
      SendClientMessage(playerid, COLOR, "Player is not connected");
    }
  }
  return 1;
}
Reply
#3

Thinks, I get 8 errors how do I define them:


C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(12 : error 017: undefined symbol "dcmd_get"
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(129) : error 017: undefined symbol "dcmd_goto"
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(133) : warning 225: unreachable code
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(133) : error 017: undefined symbol "dcmd_get"
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(135) : error 017: undefined symbol "params"
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(13 : error 017: undefined symbol "params"
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(150) : warning 225: unreachable code
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(150) : error 017: undefined symbol "dcmd_goto"
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(152) : error 017: undefined symbol "params"
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(155) : error 017: undefined symbol "params"
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(16 : warning 225: unreachable code
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


8 Errors.

Thanks again
Reply
#4

you need to add:
dcmd(get, 3, cmdtext);
dcmd(goto, 4, cmdtext);

to OnPlayerCommandText...

below the other dcmd line which you defined there (at the end of the OnPlayerCommandText function)...
Reply
#5

i think i am doing this wrong i get


C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn( : warning 201: redefinition of constant/macro (symbol "dcmd(get,")
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(9) : warning 201: redefinition of constant/macro (symbol "dcmd(goto,")
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(130) : error 017: undefined symbol "dcmd"
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(131) : warning 215: expression has no effect
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(131) : warning 215: expression has no effect
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(131) : error 001: expected token: ";", but found ")"
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(131) : error 029: invalid expression, assumed zero
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(131) : warning 215: expression has no effect
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(131) : warning 215: expression has no effect
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(131) : warning 215: expression has no effect
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(131) : error 001: expected token: ";", but found ")"
C:\Users\Ali D\Downloads\GTA Server\Script_2.8-2\ser 0.3\filterscripts\nanites.pwn(131) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#6

Use this...
Код:
#define NearbyColor 0xC6AEC7AA
#define ClientMessageColor 0x2641FEAA
#define GreyColor 0xAFAFAFAA
#define FILTERSCRIPT
#define Driver 0
#define Passanger 2
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#include <a_samp>
#include <NearbyMessageForPlayers>
forward NearbyMessageForPlayers( playerid, stringcolour, text[]);
new Act[MAX_PLAYERS];
new InCar[MAX_PLAYERS];
new WhatCar[MAX_PLAYERS];
 
public OnFilterScriptInit()
{
        print("\n-------------------------------------------");
        print(" Nanites By Ali Dumi");
        print("-------------------------------------------\n");
        return 1;
}
public OnFilterScriptExit()
{
        print("\n----------------------------------");
        print(" Nanites unloaded successfully");
        print("----------------------------------\n");
        return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
        InCar[playerid] = 0;
        return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
        if(Act[playerid] == 1)
        {
                if(oldstate == PLAYER_STATE_DRIVER)
                {
                        if(newstate == PLAYER_STATE_ONFOOT)
                        {
                                if(InCar[playerid] == 1)
                                {
                                        PutPlayerInVehicle(playerid, WhatCar[playerid], Driver);
                                }
                        }
                }
                if(oldstate == PLAYER_STATE_PASSENGER)
                {
                        if(newstate == PLAYER_STATE_ONFOOT)
                        {
                                if(InCar[playerid] == 1)
                                {
                                        PutPlayerInVehicle(playerid, WhatCar[playerid], Passanger);
                                }
                        }
                }
                if(oldstate == PLAYER_STATE_ONFOOT)
                {
                        if(newstate == PLAYER_STATE_DRIVER || PLAYER_STATE_PASSENGER)
                        {
                                InCar[playerid] = 1;
                                WhatCar[playerid] = GetPlayerVehicleID(playerid);
                        }
                }
        }
        return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
        new string[128]; new sendername[MAX_PLAYER_NAME];
        if (strcmp("/nhelp", cmdtext, true, 10) == 0) //Nanites Heal the player
{
        SendClientMessage(playerid, NearbyColor, "-----------------[Nanite Help]----------------");
                SendClientMessage(playerid, NearbyColor, "/nheal /narmour /nhealo /nvr /nantifall /nfall");
                return 1;
}
        if (strcmp("/nheal", cmdtext, true, 10) == 0) //Nanites Heal the player
{
                SetPlayerHealth(playerid, 100);
                SendClientMessage(playerid, ClientMessageColor, "You have restored your health!");
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "* %s uses his/her nanties to health thier wounds!", sendername);
        NearbyMessageForPlayers(playerid, NearbyColor, string);
                return 1;
}
        if (strcmp("/narmour", cmdtext, true, 10) == 0) //Nanites give the player armour
{
                SetPlayerArmour(playerid, 100);
                SendClientMessage(playerid, ClientMessageColor, "You have restored your armour!");
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "* %s uses his/her nanties to give them self armour!", sendername);
                NearbyMessageForPlayers(playerid, NearbyColor, string);
                return 1;
}
        if (strcmp("/nvr", cmdtext, true, 10) == 0) //Nanites Heal the car
{
                if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, GreyColor, "You are not in a vehicle!");
                RepairVehicle(GetPlayerVehicleID(playerid));
                SendClientMessage(playerid, ClientMessageColor, "You have repaired your car!");
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "* %s uses his/her nanties to repair thier car!", sendername);
                NearbyMessageForPlayers(playerid, NearbyColor, string);
                return 1;
}
//-------------------------------------[Anti Bike Fall on/off]----------------------------------------------------------
 
        if (strcmp("/nantifall", cmdtext, true, 10) == 0) //Nanites Anti Bike Fall on
{
                SendClientMessage(playerid, ClientMessageColor, "You have turned on anti fall!");
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "* %s uses his/her nanites to frimly hold them selfs to thier bike!", sendername);
                NearbyMessageForPlayers(playerid, NearbyColor, string);
                Act[playerid] = 1;
                return 1;
}
        if (strcmp("/nfall", cmdtext, true, 10) == 0) //Nanites Anti Bike Fall off
{
                Act[playerid] = 0;
                SendClientMessage(playerid, ClientMessageColor, "You have turned off anti fall!");
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "* %s uses his/her nanties and releases their grip on the bike!", sendername);
                NearbyMessageForPlayers(playerid, NearbyColor, string);
                return 1;
}
//----------------------------------[tele to player/tele player to you]-----------------------------------------------
 
//----------------------------------------[Nanite heal others]--------------------------------------------------------
 
        dcmd(nhealo, 6, cmdtext); //Heal other player
        dcmd(get, 3, cmdtext);
        dcmd(goto, 4, cmdtext)
        return 0;
}
 
dcmd_nhealo(playerid, params[])
{
    new sendername[MAX_PLAYER_NAME];
    new string[128];
        new id;
        if (strlen(params))
        {
                id = strval(params);
                if (IsPlayerConnected(id))
                {
                        SetPlayerHealth(id, 100.0);
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "* You have used your nanites to heal %s!", id);
                        SendClientMessage(playerid, ClientMessageColor, string);
                        format(string, sizeof(string), "* %s has used thier nanites to heal you!", sendername);
                        SendClientMessage(id, NearbyColor, string);
                }
                else
                {
                        SendClientMessage(playerid, GreyColor, "Player not found");
                }
        }
        else
        {
                SendClientMessage(playerid, GreyColor, "Usage: \"/nhealo <playerid>\"");
        }
        return 1;
}

dcmd_get(playerid, params[])
{
  if(!strlen(params)){
    SendClientMessage(playerid, COLOR, "/get [id]");
  }else{
    new pid = strval(params);
    if(IsPlayerConnected(pid)){
      new Float:x, Float:y, Float:z;
      GetPlayerPos(playerid, x, y, z);
      SetPlayerPos(pid, x+1, y+1, z);
    }else{
      SendClientMessage(playerid, COLOR, "Player is not connected");
    }
  }
  return 1;
}

dcmd_goto(playerid, params[])
{
  if(!strlen(params)){
    SendClientMessage(playerid, COLOR, "/goto [id]");
  }else{
    new pid = strval(params);
    if(IsPlayerConnected(pid)){
      new Float:x, Float:y, Float:z;
      GetPlayerPos(pid, x, y, z);
      SetPlayerPos(playerid, x+1, y+1, z);
    }else{
      SendClientMessage(playerid, COLOR, "Player is not connected");
    }
  }
  return 1;
}
Reply
#7

Thank you very much
Reply
#8

Is there any way to make it so only players that are give rights can use the cmds, so admins can give rights and take rights from those that abuse them. Thanks in advance Alastair
Reply
#9

Ali, why are you taking some of AR:RP's ideas. Oh yes, i am a player there, and im kinda disappointed :/
Reply
#10

I loled, Ali Dumi, You sir fail

Stealing Stuff From AR:RP

Yes i am Also a Player from AR:RP.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)