dcmd_goto(playerid, params[]) { #pragma unused params new ID; if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_BLUE, "USAGE: /goto [ID]"); else if(!IsPlayerConnected(ID) || ID == playerid) return SendClientMessage(playerid, COLOR_RED, "ERROR: {FFFFFF}This player is offline or it is yourself"); if(toggoto[ID] == 1) { new string[50], name[MAX_PLAYER_NAME]; format(string, sizeof(string), "%s's has Disabled goto! /toggoto", GetPlayerName(playerid, name, sizeof(name))); GameTextForPlayer(playerid,string,2000,3); return 1; } else { new Float:x, Float:y, Float:z; GetPlayerPos(ID, x, y, z); SetPlayerPos(ID, x+2, y, z); } return 1; } dcmd_toggoto(playerid, params[]) { #pragma unused params if(IsPlayerConnected(playerid)) { if(toggoto[playerid] == 1) { toggoto[playerid] = 0; GameTextForPlayer(playerid,"~b~You have ~g~enabled ~b~goto",2000,3); return 1; } else { toggoto[playerid] = 1; GameTextForPlayer(playerid,"~b~You have ~r~disabled ~b~goto",2000,3); return 1; } } return 1; }
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
new Float:p[3];
GetPlayerPos(clickedplayerid,p[0],p[1],p[2]);
SetPlayerPos(playerid,p[0]+2,p[1]+2,p[2]+2);
return 1;
}
#include <a_samp>
#include "../include/gl_common.inc"
#define FILTERSCRIPT
#define COLOR_WHITE 0xFFFFFFFF
public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
new cmd[256];
cmd = strtok(cmdtext, idx);
if(strcmp("/tele", cmd, true) == 0)
{
if(IsPlayerAdmin(playerid)) {
new tmp[256], player, Float:X, Float:Y, Float:Z, carid, seat;
tmp = strtok(cmdtext, idx);
player = strval(tmp);
GetPlayerPos(player, X, Y, Z);
if(IsPlayerInAnyVehicle(playerid)){
carid = GetPlayerVehicleID(playerid);
seat = GetPlayerVehicleSeat(playerid);
SetVehiclePos(carid, X+1, Y, Z);
PutPlayerInVehicle(playerid, carid, seat);
return 1;
}
SetPlayerPos(playerid, X+1, Y, Z);
return 1;
}
else{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are not authorized to use this command.");
return 1;
}
}
if(strcmp("/get", cmd, true) == 0)
{
if(IsPlayerAdmin(playerid)) {
new tmp[256], player, Float:X, Float:Y, Float:Z, carid, seat;
tmp = strtok(cmdtext, idx);
player = strval(tmp);
GetPlayerPos(playerid, X, Y, Z);
if(IsPlayerInAnyVehicle(player)){
carid = GetPlayerVehicleID(player);
seat = GetPlayerVehicleSeat(player);
SetVehiclePos(carid, X+1, Y, Z);
PutPlayerInVehicle(player, carid, seat);
return 1;
}
SetPlayerPos(player, X+1, Y, Z);
return 1;
}
else{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are not authorized to use this command.");
return 1;
}
}
return 0;
}
dcmd_goto(playerid, params[]) { #pragma unused params new ID; if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_BLUE, "USAGE: /goto [ID]"); else if(!IsPlayerConnected(ID) || ID == playerid) return SendClientMessage(playerid, COLOR_RED, "ERROR: {FFFFFF}This player is offline or it is yourself"); if(toggoto[ID] == 1) { new string[50], name[MAX_PLAYER_NAME]; format(string, sizeof(string), "%s's has Disabled goto! /toggoto", GetPlayerName(playerid, name, sizeof(name))); GameTextForPlayer(playerid,string,2000,3); return 1; } else { new Float:x, Float:y, Float:z; GetPlayerPos(ID, x, y, z); SetPlayerPos(ID, x+2, y, z); } return 1; } dcmd_toggoto(playerid, params[]) { #pragma unused params if(IsPlayerConnected(playerid)) { if(toggoto[playerid] == 1) { toggoto[playerid] = 0; GameTextForPlayer(playerid,"~b~You have ~g~enabled ~b~goto",2000,3); return 1; } else { toggoto[playerid] = 1; GameTextForPlayer(playerid,"~b~You have ~r~disabled ~b~goto",2000,3); return 1; } } return 1; }
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
Just check if playerid is driver with
pawn Код:
|
dcmd_goto(playerid, params[]) { #pragma unused params new ID; if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_BLUE, "USAGE: /goto [ID]"); else if(!IsPlayerConnected(ID) || ID == playerid) return SendClientMessage(playerid, COLOR_RED, "ERROR: {FFFFFF}This player is offline or it is yourself"); if(toggoto[ID] == 1) { new string[50], name[MAX_PLAYER_NAME]; format(string, sizeof(string), "%s's has Disabled goto! /toggoto", GetPlayerName(playerid, name, sizeof(name))); GameTextForPlayer(playerid,string,2000,3); if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) GetVehiclePos(vehicleid, x, y, z); SetVehiclePos(vehicleid, x+3, y ,z); return 1; } else { new Float:x, Float:y, Float:z; GetPlayerPos(ID, x, y, z); SetPlayerPos(ID, x+2, y, z); } return 1; }
// Command
new Float:x, Float:y, Float:z;
GetPlayerPos(ID, x, y, z);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) SetVehiclePos(GetPlayerVehicleID(playerid), x+3, y, z);
else SetPlayerPos(playerid, x+2, y, z); // On foot.