how to make this work
#1

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
Reply
#2

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.
Reply
#3

didnt help && wtf pickup?
Reply
#4

ohshit...oops...
1sec...
Reply
#5

lol gg^^ xD
take ur times
Reply
#6

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

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

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

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.
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)