#1

hey guys i wonder how i can make a goto command(not only for admins)with zcmd include :
can you help me?
In Advance,
Blacklisted_Bboy
Reply
#2

Using sscanf to parse the player id, it's very simple.

pawn Код:
CMD:goto(playerid, params[]) {
    new
        iTarget; // Create a temporary variable for the command

    if(sscanf(params, "u", iTarget)) // get the player ID and load it in to 'iTarget'
        return SendClientMessage(playerid, 0, "Syntax: /goto [playerid]");

    if(iTarget == INVALID_PLAYER_ID) // INVALID_PLAYER_ID is the value of 'iTarget' if the player isn't connected
        return SendClientMessage(playerid, 0, "Player isn't connected.");
       
    new
        Float: fPlayerPos[3]; // Create a temporary array to store the floats in
       
    GetPlayerPos(iTarget, fPlayerPos[0], fPlayerPos[1], fPlayerPos[2]); // Get the target player's position
    SetPlayerPos(playerid, fPlayerPos[0], fPlayerPos[1], fPlayerPos[2]); // Set the current player's position
    return 1;
}
Reply
#3

pawn Код:
CMD:goto(playerid, params[])
{
    new targetid, Float:X, Float:Y, Float:Z;
    if(sscanf(params,"i", targetid)) return SCM(playerid, COLOR_RED,"[ERROR]: Usage: /goto [playerid]");
    if(targetid == playerid ) return SCM(playerid, COLOR_RED, "[ERROR]: You cannot teleport to yourself!");
    if(IsPlayerConnected(targetid) == 0) return SCM(playerid, COLOR_RED, "[ERROR]: Player is not connected!");
    GetPlayerPos(targetid, X, Y, Z );
    if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER)SetVehiclePos( GetPlayerVehicleID(playerid), X+2, Y+2, Z );
    else SetPlayerPos( playerid, X+2, Y+2, Z );
    return 1;
}
Reply
#4

re malaka gt den m eipes oti exeis katevasei to xtreamgaming...oute credits den tou exeis dwsei ki olas...
Reply
#5

Den exo kanei kana release gia na doso credits. To eixa katevasei, alla itan adio kai to gemisa
Reply
#6

greek isn't english D:
Reply
#7

den ennow auto re...ennow oti gt den m to pes :P
Reply
#8

Meta is correct, we should talk English here
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)