SA-MP Forums Archive
Drag CMD Warning - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Drag CMD Warning (/showthread.php?tid=465861)



Drag CMD Warning - Jizz - 24.09.2013

warning 204: symbol is assigned a value that is never used: "string"

pawn Код:
CMD:drag(playerid, params[])
{
    new string[128], giveplayerid;
    if(IsACop(playerid) || (PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 5) || PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 2 || (PlayerInfo[playerid][pFaction] == 3 && PlayerInfo[playerid][pRank] >= 10))
    if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /drag [playerid/partofname]");
    if(PlayerCuffed[giveplayerid] == 1) return SendClientMessage(playerid, COLOR_WHITE, "This player must first be cuffed");
    if(Dragged[playerid] == 0 && Drag[playerid] == 0)
    Dragged[playerid] = 1;
    Drag[playerid] = 1;
    return 1;
}



Re: Drag CMD Warning - Konstantinos - 24.09.2013

What does it say? That string is never used. So..

• either format a message and send it (using string).
• or remove "string[128], " from the code if you're not going to use it anywhere in that command.


Re: Drag CMD Warning - Jizz - 24.09.2013

Found another problem: error 001: expected token: ")", but found "return"

pawn Код:
if(ProxDetectorS(5.0, playerid, giveplayerid) return SendClientMessage(playerid, COLOR_WHITE, "That player isn't near you.");



Re: Drag CMD Warning - Konstantinos - 24.09.2013

You did not close the parantheses at the end of the if statement (before return).
pawn Код:
if(ProxDetectorS(5.0, playerid, giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "That player isn't near you.");



Re: Drag CMD Warning - Jizz - 24.09.2013

Anyway, I can't drag em.
pawn Код:
CMD:drag(playerid, params[])
{
    new giveplayerid;
    if(IsACop(playerid) || (PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 5) || PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 2 || (PlayerInfo[playerid][pFaction] == 3 && PlayerInfo[playerid][pRank] >= 10))
    if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /drag [playerid/partofname]");
    if(PlayerCuffed[giveplayerid] == 1) return SendClientMessage(playerid, COLOR_WHITE, "This player must first be cuffed");
    if(!ProxDetectorS(3.0, playerid, giveplayerid))
    {
        SendClientMessage(playerid, COLOR_GREY, "That player isn't near you.");
        return 1;
    }
    if(Dragged[playerid] == 0 && Drag[playerid] == 0)
    Dragged[playerid] = 1;
    Drag[playerid] = 1;
    return 1;
}

CMD:stopdrag (playerid, params[])
{
    if(IsACop(playerid) || (PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 5) || PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 2 || (PlayerInfo[playerid][pFaction] == 3 && PlayerInfo[playerid][pRank] >= 10))
    Dragged[playerid] = 0;
    Drag[playerid] = 0;
    {
    return 1;
    }
}

//DRAG
forward Draggingt(playerid, ID);
public Draggingt(playerid, ID)
{
new Float:dX, Float:dY, Float:dZ;
GetPlayerPos(playerid, dX, dY, dZ);
SetPlayerPos(ID, dX+1, dY, dZ);
}



Re: Drag CMD Warning - Konstantinos - 24.09.2013

Erm, it should be using a timer for that.


Re: Drag CMD Warning - Jizz - 24.09.2013

I don't want to use timer. How to remove the timer scripts?


Re: Drag CMD Warning - Konstantinos - 24.09.2013

This is the timer's callback:
pawn Код:
//DRAG
forward Draggingt(playerid, ID);
public Draggingt(playerid, ID)
{
new Float:dX, Float:dY, Float:dZ;
GetPlayerPos(playerid, dX, dY, dZ);
SetPlayerPos(ID, dX+1, dY, dZ);
}
What do you want to do anyways?


Re: Drag CMD Warning - Jizz - 24.09.2013

Just normal drag system, please.