#include <a_samp> #include <zcmd> #include <sscanf2> //SSCANF PLUGIN NEED TO BE IN THE STRING "plugins" OF YOUR server.cfg (I know there isn't this string, just write under everything: plugins sscanf)
CMD:goto(playerid, params[]) { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "You need to be RCON for use this command"); //This is the line that define if the player is an admin or not, notice: the "!" is same as "if is not" (you can change with your enums); return 1; }
CMD:goto(playerid, params[]) { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "You need to be RCON for use this command"); new ID; //This is the player target (like targetid) new pn[MAX_PLAYER_NAME]; //This is the param of ID and it is used for define who was the target new an[MAX_PLAYER_NAME];//Same as above but this is used for "me" (playerid), MAX_PLAYER_NAME is the param that get our name new str[128]; //This is the string that we'll use in "format" return 1; }
CMD:goto(playerid, params[]) { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "You need to be RCON for use this command"); new ID; new pn[MAX_PLAYER_NAME]; new an[MAX_PLAYER_NAME]; new str[128]; if(sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /goto [ID]"); //This is a long line, "sscanf" is the plugin that search the missing params, "params" is the param that define params LOL, "u" is the PARAM that define the MISSING ID, ID is the param for the targetid if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: This player is not connected");//Same as !IsPlayerAdmin, but instead of "playerid" we put "ID" because it's the targetid GetPlayerName(playerid, an, MAX_PLAYER_NAME);//Define the playerid's param GetPlayerName(ID, pn, MAX_PLAYER_NAME);//Define the ID's param new Float:x; //Defining float X new Float:y; //Same new Float:z; //Same GetPlayerPos(ID, x, y, z); //This line get the "ID" position SetPlayerPos(playerid, x+1, y+1, z); //This line set the "playerid" position from "ID" position, with some changes(x+1, y+1); format(str, sizeof(str), "You have been teleported to %s", pn); //Showed before, this is the line that give the message to playerid) SendClientMessage(playerid, 0x00FF00AA, str); //This line give the message to playerid if(IsPlayerInAnyVehicle(playerid)) //Mhh, let's give you a question, what should this callback do? { GetPlayerPos(ID, x, y, z); SetVehiclePos(playerid, x+1, y+1, z); //And this one? :D } return 1; }
GetVehiclePos(ID, x, y, z); PutPlayerInVehicle(playerid, ID, 2);//"2" is the seatid
new Float:pos[3]; GetPlayerPos(ID, pos[0], pos[1], pos[2]);
new Float:x; //Defining float X new Float:y; //Same new Float:z; //Same GetPlayerPos(ID, x, y, z); //This line get the "ID" position
Isn't it easier to get the positions like this :
Код:
new Float:pos[3]; GetPlayerPos(ID, pos[0], pos[1], pos[2]); Код:
new Float:x; //Defining float X new Float:y; //Same new Float:z; //Same GetPlayerPos(ID, x, y, z); //This line get the "ID" position |