SA-MP Forums Archive
how to make this work - 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: how to make this work (/showthread.php?tid=164120)



how to make this work - willsuckformoney - 30.07.2010

pawn Код:
dcmd_stand(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid)) {
        if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /stand [playerid]");
        new player1 = strval(params), string[128], Float:X,Float:Y,Float:Z;
        if(IsPlayerConnected(player1)) {
            CMDMessageToAdmins(playerid,"STAND");
            GetPlayerPos(player1,X,Y,Z);
            stand = CreateObject(2898,X,Y,Z,0,0,0);
            format(string, sizeof(string), "You have Created a Stand-On object for %s", pName(player1) );
            return SendClientMessage(playerid,blue, string);
        } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
i wanted it to make it so that when you do /stand [playerid] is places the object, that works i want it so that when you do it again then it deletes the first object


Re: how to make this work - John_F - 30.07.2010

pawn Код:
dcmd_stand(playerid,params[]) {
    new stand2 = 0;
    if(stand2 == 0)
    {
    if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
    {
        if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /stand [playerid]");
        new player1 = strval(params), string[128], Float:X,Float:Y,Float:Z;
        if(IsPlayerConnected(player1))
        {
            CMDMessageToAdmins(playerid,"STAND");
            GetPlayerPos(player1,X,Y,Z);
            stand = CreateObject(2898,X,Y,Z,0,0,0);
            format(string, sizeof(string), "You have Created a Stand-On object for %s", pName(player1) );
            return SendClientMessage(playerid,blue, string);
            stand2 = 1;
        }
        else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
    }
    else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
  }

  else
  {
  DestroyObject(stand);
  stand2 = 1;
  }
Not 100% sure this will work, but I'm pretty sure it will.

EDITED: Fixed it, forgot some stuff and accidentally named the placeholder variable the same thing as the object reference variable.


Re: how to make this work - willsuckformoney - 30.07.2010

didnt help && wtf pickup?


Re: how to make this work - John_F - 30.07.2010

ohshit...oops...
1sec...


Re: how to make this work - willsuckformoney - 30.07.2010

lol gg^^ xD
take ur times


Re: how to make this work - John_F - 30.07.2010

Fixed. That should work now :P
Scripting blindly is not as easy at it looks.


Re: how to make this work - willsuckformoney - 30.07.2010

Код:
C:\Users\Charlie\Desktop\server 2\filterscripts\ladmin4v2.pwn(1487) : warning 225: unreachable code
pawn Код:
stand2 = 1;
&&&^^^


Re: how to make this work - willsuckformoney - 30.07.2010

fixed xD its all about where you put it xD annnndd it dont delete the first object -_-


Re: how to make this work - John_F - 30.07.2010

O.o are you sure you put it in the right place?
Does dcmd have any special way of writing conditionals? Try using it in strcmp and getting rid of the returns, wrapping the else's in braces instead.


Re: how to make this work - willsuckformoney - 30.07.2010

lol its hard to make a ladmin cmd go to strcmp cmd