SA-MP Forums Archive
Function Problem ?? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Function Problem ?? (/showthread.php?tid=193749)



Function Problem ?? - iRana - 27.11.2010

Hi Guys I made I function SetPosToPlayer(playerid,giveid) but on use it gives me this error:

Error :
pawn Код:
error 035: argument type mismatch (argument 2)
By code Also try public SetPosToPlayer(playerid,giveid);
pawn Код:
stock SetPosToPlayer(playerid,giveid)
        {
        new Float:gx,Float:gy,Float:gz;
        GetPlayerPos(giveid, gx, gy, gz);
        SetPlayerPos(playerid,gx,gy+2, gz);
        return 1;
    }

CMD:

CMD:goto(playerid, params[])
    {
        new giveid[MAX_PLAYERS];
        if(sscanf(params,"d",giveid)) return SendClientMessage(playerid,USAGE,"Usage : /goto <playerid>");
        else {
        SetPosToPlayer(playerid,giveid);//Error is in this line }
        return 1;
 }
I want to make this Function.



Re: Function Problem ?? - Mean - 27.11.2010

pawn Код:
stock SetPosToPlayer(playerid,giveid)
{
    new Float:gx,Float:gy,Float:gz;
    GetPlayerPos(giveid, gx, gy, gz);
    SetPlayerPos(playerid,gx,gy+2, gz);
    return 1;
}
re-placed ur braces, compiles sucesfully for me
else idk
and umm, what does this CMD: [nothing here] does there?? remove that
So full code would be
pawn Код:
stock SetPosToPlayer(playerid,giveid)
{
        new Float:gx,Float:gy,Float:gz;
        GetPlayerPos(giveid, gx, gy, gz);
        SetPlayerPos(playerid,gx,gy+2, gz);
        return 1;
}


CMD:goto(playerid, params[])
{
        new giveid[MAX_PLAYERS];
        if(sscanf(params,"d",giveid)) return SendClientMessage(playerid,USAGE,"Usage : /goto <playerid>");
        else {
        SetPosToPlayer(playerid,giveid);//Error is in this line }
        return 1;
}



Re: Function Problem ?? - iRana - 27.11.2010

Same error again


Re: Function Problem ?? - webninjasi - 27.11.2010

Delete this [MAX_PLAYERS]


Re: Function Problem ?? - iRana - 27.11.2010

Ye I make /goto car and function in same way and its work but this one is not working ? ? ? ?? ? ? ?


Re: Function Problem ?? - iRana - 27.11.2010

Quote:
Originally Posted by webninjasi
Посмотреть сообщение
Delete this [MAX_PLAYERS]
Ye Thanks Works I del before watching you comment.....

SOLVED