Help with a command.
#1

Код:
CMD:drag(playerid, params[])
{
    new giveplayerid, giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[128], DragOff[MAX_PLAYERS];
    if(sscanf(params,"u",giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE,"USAGE: /drag [playerid]");
    if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "That Player is offline !");
    if(!ProxDetectorS(3.0, playerid, giveplayerid)) return SendClientMessage(playerid, COLOR_GREY,"That player isn't near you !");
    if(DragOff[giveplayerid] > 0) return SendClientMessage(playerid, COLOR_GREY,"You are already being Dragged!");
    if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, "You Cannot Drag Yourself!");
    if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid) || PlayerInfo[giveplayerid][pMember] == 2 || PlayerInfo[giveplayerid][pMember] == 6 || PlayerInfo[giveplayerid][pLeader] == 6)
    { return SendClientMessage(playerid, COLOR_GREY,"You can't drag cops"); }
    if(gTeam[playerid] == 2 || IsACop(playerid) || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
    {
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "* You are being dragged by %s,", sendername);
        SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
         format(string, sizeof(string), "* You begin to drag %s,", giveplayer);
         SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
         format(string, sizeof(string), "* %s has started to drag %s.", sendername ,giveplayer);
         ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
         TogglePlayerControllable(giveplayerid, 0);
         DragOff[giveplayerid] = playerid;
    }
    else return SendClientMessage(playerid, COLOR_GREY,"You are not a cop");
    return 1;
}
I want to make it movable..
Can anyone help me?
Reply
#2

What do you mean movable?
Reply
#3

Means that
I shows only the messages
I want that the police can drag him.
Reply
#4

Run a loop get the cops position and then move the player to his position each time.
Reply
#5

Код:
new draggedtimer[MAX_PLAYERS];

CMD:drag(playerid, params[])
{
    new giveplayerid, giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[128], DragOff[MAX_PLAYERS];
    if(sscanf(params,"u",giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE,"USAGE: /drag [playerid]");
    if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "That Player is offline !");
    if(!ProxDetectorS(3.0, playerid, giveplayerid)) return SendClientMessage(playerid, COLOR_GREY,"That player isn't near you !");
    if(DragOff[giveplayerid] > 0) return SendClientMessage(playerid, COLOR_GREY,"You are already being Dragged!");
    if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, "You Cannot Drag Yourself!");
    if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid) || PlayerInfo[giveplayerid][pMember] == 2 || PlayerInfo[giveplayerid][pMember] == 6 || PlayerInfo[giveplayerid][pLeader] == 6)
    { return SendClientMessage(playerid, COLOR_GREY,"You can't drag cops"); }
    if(gTeam[playerid] == 2 || IsACop(playerid) || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
    {
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "* You are being dragged by %s,", sendername);
        SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
         format(string, sizeof(string), "* You begin to drag %s,", giveplayer);
         SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
         format(string, sizeof(string), "* %s has started to drag %s.", sendername ,giveplayer);
         ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
         TogglePlayerControllable(giveplayerid, 0);
         DragOff[giveplayerid] = playerid;
         draggedtimer[giveplayerid] = SetTimerEx("DragTimer", 1000, true, playerid, giveplayerid);
    }
    else return SendClientMessage(playerid, COLOR_GREY,"You are not a cop");
    return 1;

forward DragTimer(playerid, giveplayerid);
public DragTimer(playerid, giveplayerid)
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    SetPlayerPos(giveplayerid, X-1, Y, Z);
    return 1;
}
Reply
#6

Quote:
Originally Posted by JhnzRep
Посмотреть сообщение
Код:
new draggedtimer[MAX_PLAYERS];

CMD:drag(playerid, params[])
{
    new giveplayerid, giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[128], DragOff[MAX_PLAYERS];
    if(sscanf(params,"u",giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE,"USAGE: /drag [playerid]");
    if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "That Player is offline !");
    if(!ProxDetectorS(3.0, playerid, giveplayerid)) return SendClientMessage(playerid, COLOR_GREY,"That player isn't near you !");
    if(DragOff[giveplayerid] > 0) return SendClientMessage(playerid, COLOR_GREY,"You are already being Dragged!");
    if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, "You Cannot Drag Yourself!");
    if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid) || PlayerInfo[giveplayerid][pMember] == 2 || PlayerInfo[giveplayerid][pMember] == 6 || PlayerInfo[giveplayerid][pLeader] == 6)
    { return SendClientMessage(playerid, COLOR_GREY,"You can't drag cops"); }
    if(gTeam[playerid] == 2 || IsACop(playerid) || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
    {
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "* You are being dragged by %s,", sendername);
        SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
         format(string, sizeof(string), "* You begin to drag %s,", giveplayer);
         SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
         format(string, sizeof(string), "* %s has started to drag %s.", sendername ,giveplayer);
         ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
         TogglePlayerControllable(giveplayerid, 0);
         DragOff[giveplayerid] = playerid;
         draggedtimer[giveplayerid] = SetTimerEx("DragTimer", 1000, true, playerid, giveplayerid);
    }
    else return SendClientMessage(playerid, COLOR_GREY,"You are not a cop");
    return 1;

forward DragTimer(playerid, giveplayerid);
public DragTimer(playerid, giveplayerid)
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    SetPlayerPos(giveplayerid, X-1, Y, Z);
    return 1;
}
Код:
C:\Users\garg\Desktop\Vernit\SA-MP\SLRP\gamemodes\MSRPMaps.pwn(94893) : error 035: argument type mismatch (argument 4)
C:\Users\garg\Desktop\Vernit\SA-MP\SLRP\gamemodes\MSRPMaps.pwn(94898) : warning 225: unreachable code
C:\Users\garg\Desktop\Vernit\SA-MP\SLRP\gamemodes\MSRPMaps.pwn(94898) : error 029: invalid expression, assumed zero
C:\Users\garg\Desktop\Vernit\SA-MP\SLRP\gamemodes\MSRPMaps.pwn(94898) : error 017: undefined symbol "DragTimer"
C:\Users\garg\Desktop\Vernit\SA-MP\SLRP\gamemodes\MSRPMaps.pwn(94899) : error 029: invalid expression, assumed zero
C:\Users\garg\Desktop\Vernit\SA-MP\SLRP\gamemodes\MSRPMaps.pwn(94899) : error 017: undefined symbol "DragTimer"
C:\Users\garg\Desktop\Vernit\SA-MP\SLRP\gamemodes\MSRPMaps.pwn(94906) : error 030: compound statement not closed at the end of file (started at line 94873)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Reply
#7

Код:
CMD:drag(playerid, params[])
{
    new giveplayerid, giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[128], DragOff[MAX_PLAYERS];
    if(sscanf(params,"u",giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE,"USAGE: /drag [playerid]");
    if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "That Player is offline !");
    if(!ProxDetectorS(3.0, playerid, giveplayerid)) return SendClientMessage(playerid, COLOR_GREY,"That player isn't near you !");
    if(DragOff[giveplayerid] > 0) return SendClientMessage(playerid, COLOR_GREY,"You are already being Dragged!");
    if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, "You Cannot Drag Yourself!");
    if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid) || PlayerInfo[giveplayerid][pMember] == 2 || PlayerInfo[giveplayerid][pMember] == 6 || PlayerInfo[giveplayerid][pLeader] == 6)
    { return SendClientMessage(playerid, COLOR_GREY,"You can't drag cops"); }
    if(gTeam[playerid] == 2 || IsACop(playerid) || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
    {
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "* You are being dragged by %s,", sendername);
        SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
         format(string, sizeof(string), "* You begin to drag %s,", giveplayer);
         SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
         format(string, sizeof(string), "* %s has started to drag %s.", sendername ,giveplayer);
         ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
         TogglePlayerControllable(giveplayerid, 0);
         DragOff[giveplayerid] = playerid;
         draggedtimer[giveplayerid] = SetTimerEx("DragTimer", 1000, true, playerid, giveplayerid);
    }
    else return SendClientMessage(playerid, COLOR_GREY,"You are not a cop");
    return 1;
}
Forgot a bracket at the end of that command.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)