Object problem
#1

I wanted to make a cmd when i write /block that an object creates near me and when i type removeblock that it removes but i dont know how to make that. Here is the code.

new block;

If(strcmp(cmdtext,"/removeblock",true)

DestroyObject(block);
return 1;

//----------------------------[Block]-------------------------------------------

if(strcmp(cmdtext,"/block",true)==0)
if(gTeam[playerid] == TEAM_ARMY)
new Float, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
CreateObject(block,981,x,y,z);
else
}
SendClientMessage(playerid,COLOR_LIGHTBLUE,"You need to be army if you want to use this command");

//CreateObject(981, 2266.821533, -1591.052002, 3.209601, 0.0000, 0.0000, 270.0000);



return 1;
}
return 0;
}






D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\gamemodes\abcd.pwn(112 : warning 225: unreachable code
D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\gamemodes\abcd.pwn(1130) : error 003: declaration of a local variable must appear in a compound block
D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\gamemodes\abcd.pwn(1130) : warning 221: label name "Float" shadows tag name
D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\gamemodes\abcd.pwn(1130) : error 017: undefined symbol "x"
D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\gamemodes\abcd.pwn(1130) : warning 215: expression has no effect
D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\gamemodes\abcd.pwn(1131) : error 017: undefined symbol "x"
D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\gamemodes\abcd.pwn(1132) : error 017: undefined symbol "x"
D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\gamemodes\abcd.pwn(1133) : error 029: invalid expression, assumed zero
D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\gamemodes\abcd.pwn(1130) : warning 203: symbol is never used: "Float"
D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\gamemodes\abcd.pwn(1130 -- 1143) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Reply
#2

Theres a lot of problems here.
First of all you havn't got the correct amount of opening/closiing braces, second of all your CreateObject parameter format is incorrect - check the wiki, it goes like this:
pawn Code:
CreateObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ)
Another problem is that you never defined what "block" is and also model id of 981 will not work according to the wiki, so basically you can't create that object.

Anyways, change your object modelid to a working one and also the Object rotations and your command should be something like this:

pawn Code:
if(strcmp(cmdtext,"/block",true)==0)
    {
        if(gTeam[playerid] == TEAM_ARMY)
        {
            new Float:x, Float:y, Float:z;
            GetPlayerPos(playerid,x,y,z);
            CreateObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ)
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"Object Created Successfully!");
        }
        else SendClientMessage(playerid,COLOR_LIGHTBLUE,"You need to be army if you want to use this command");
        //CreateObject(981, 2266.821533, -1591.052002, 3.209601, 0.0000, 0.0000, 270.0000);
        return 1;
    }
Good Luck.
Reply
#3

First problem is this:

pawn Code:
If(strcmp(cmdtext,"/removeblock",true)

      DestroyObject(block);
return 1;
that should be:
pawn Code:
If(strcmp(cmdtext,"/removeblock",true)
{
  DestroyObject(block);
  return 1;
}
Reply
#4

Quote:
Originally Posted by 0rb
First problem is this:

pawn Code:
If(strcmp(cmdtext,"/removeblock",true)

      DestroyObject(block);
return 1;
that should be:
pawn Code:
If(strcmp(cmdtext,"/removeblock",true)
{
  DestroyObject(block);
  return 1;
}
oops, didn't see that command lol - that's the first probem!
Reply
#5

K, ty.
Aint some good scripter so i made that much mistakes...
Reply
#6

Huh...
//----------------------------[Block]-------------------------------------------

if(strcmp(cmdtext,"/block",true)==0)
{
if(gTeam[playerid] == TEAM_ARMY)
{
new Float, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
1134 CreateObject(981, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Object Created Successfully!");
}
else SendClientMessage(playerid,COLOR_LIGHTBLUE,"You need to be army if you want to use this command");
//CreateObject(981, 2266.821533, -1591.052002, 3.209601, 0.0000, 0.0000, 270.0000);

return 1;
}

D:\New Folder\GTA San Andreas\SAMP\SAMP SERVER\gamemodes\abcd.pwn(1134) : error 017: undefined symbol "X"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#7

Pawn is case sensitive.
Reply
#8

Quote:
Originally Posted by 0rb
Pawn is case sensitive.
k
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)