/roadblock
#1

-------- removed
Reply
#2

pawn Код:
if(strcmp(cmdtext, "/roadblock", true)==0)
{
  new Float:X, Float:Y, Float:Z, Float:A;
  GetPlayerPos(playerid, X, Y, Z);
  GetPlayerFacingAngle(playerid, A);
  block = CreatePlayerObject(playerid,978, X, Y, Z, 0.0, 0.0, A);
  SendClientMessage(playerid, COLOR_GREEN, "RoadBlock Successfully Deployed");
  return 1;
}
  if(strcmp(cmdtext, "/destroyblock", true)==0)
{
  DestroyPlayerObject(playerid,block);
  return 1;
}
Fixed the code,try now,
add the gTeam yourself of use search.
Thanks,
Reply
#3

doesn't CreatePlayerObject

create an object, thats only visible for one player? and thats certainly not the point ina road block
cant find any wiki to back it up :S so correct me when wrong!
Reply
#4

Код:
if(strcmp(cmdtext, "/roadblock", true)==0)
{
  new Float:X, Float:Y, Float:Z, Float:A;
  GetPlayerPos(playerid, X, Y, Z);
  GetPlayerFacingAngle(playerid, A);
  block = CreatePlayerObject(playerid,978, X, Y, Z, 0.0, 0.0, A);
  SendClientMessage(playerid, COLOR_GREEN, "RoadBlock Successfully Deployed");
  return 1;
}
  if(strcmp(cmdtext, "/destroyblock", true)==0)
{
  DestroyPlayerObject(playerid,block);
  return 1;
}
That gives me 5 Errors...

Код:
C:\Dokumente und Einstellungen\Flo\Desktop\samp022server.win32\gamemodes\Kopie von GF.pwn(1997) : error 010: invalid function or declaration
C:\Dokumente und Einstellungen\Flo\Desktop\samp022server.win32\gamemodes\Kopie von GF.pwn(2000) : error 021: symbol already defined: "GetPlayerPos"
C:\Dokumente und Einstellungen\Flo\Desktop\samp022server.win32\gamemodes\Kopie von GF.pwn(2004) : error 010: invalid function or declaration
C:\Dokumente und Einstellungen\Flo\Desktop\samp022server.win32\gamemodes\Kopie von GF.pwn(2006) : error 010: invalid function or declaration
C:\Dokumente und Einstellungen\Flo\Desktop\samp022server.win32\gamemodes\Kopie von GF.pwn(2009) : error 010: invalid function or declaration
Reply
#5

pawn Код:
if(strcmp(cmdtext, "/roadblock", true)==0)
{
  new Float:X, Float:Y, Float:Z, Float:A;
  GetPlayerPos(playerid, X, Y, Z);
  GetPlayerFacingAngle(playerid, A);
  block = CreateObject(playerid,978, X, Y, Z, 0.0, 0.0, A);
  SendClientMessage(playerid, COLOR_GREEN, "RoadBlock Successfully Deployed");
  return 1;
}
  if(strcmp(cmdtext, "/destroyblock", true)==0)
{
  DestroyObject(playerid,block);
  return 1;
}
Sorry i was in a hurry.
Reply
#6

Now i have these errors:

Код:
C:\Dokumente und Einstellungen\Flo\Desktop\samp022server.win32\gamemodes\GF.pwn(1774) : error 010: invalid function or declaration
C:\Dokumente und Einstellungen\Flo\Desktop\samp022server.win32\gamemodes\GF.pwn(1777) : error 021: symbol already defined: "GetPlayerPos"
C:\Dokumente und Einstellungen\Flo\Desktop\samp022server.win32\gamemodes\GF.pwn(1781) : error 010: invalid function or declaration
C:\Dokumente und Einstellungen\Flo\Desktop\samp022server.win32\gamemodes\GF.pwn(1783) : error 010: invalid function or declaration
C:\Dokumente und Einstellungen\Flo\Desktop\samp022server.win32\gamemodes\GF.pwn(1786) : error 010: invalid function or declaration
Reply
#7

Код:
#include <a_samp>
#define COLOR_GREEN 0x00FF00AA
new CreatedBlocks[200];
new CreatedBlock = 0;

public OnPlayerCommandText(playerid, cmdtext[]){
if(strcmp(cmdtext, "/roadblock", true)==0)
{
 new Float:X, Float:Y, Float:Z, Float:A;
 GetPlayerPos(playerid, X, Y, Z);
 GetPlayerFacingAngle(playerid, A);
 new block = CreateObject(978, X, Y, Z, 0.0, 0.0, A);
 CreatedBlocks[CreatedBlock] = block;
 CreatedBlock++;
 SendClientMessage(playerid, COLOR_GREEN, "RoadBlock Successfully Deployed");
 return 1;
}
if(strcmp(cmdtext, "/destroyallblocks", true)==0)
{
 for(new i = 0; i <= CreatedBlocks[i]; i++) DestroyObject(CreatedBlocks[i]);
 return 1;
}
return 0;
}
Reply
#8

he wanted that it only one block possible per team not per player or ?
pawn Код:
if(!strcmp("/roadblock", cmdtext, true))
{
    static Block[2];
    new Float:X, Float:Y, Float:Z, Float:A;
    if(Team[playerid] == COP)
    {
        if(!Block[0])
        {
            GetPlayerPos(playerid, X, Y, Z);
            GetPlayerFacingAngle(playerid, A);
            block[0] = CreateObject(978, X, Y, Z, 0.0, 0.0, A);
            SendClientMessage(playerid, COLOR_GREEN, "RoadBlock Successfully Deployed");
        }
        else
        {
            DestroyObject(block[0]);
            block[0] = false;
            SendClientMessage(playerid, COLOR_RED, "RoadBlock Successfully Destroyed");
        }
    }
    else if(Team[playerid] == FBI)
    {
        if(!Block[1])
        {
            GetPlayerPos(playerid, X, Y, Z);
            GetPlayerFacingAngle(playerid, A);
            block[1] = CreateObject(978, X, Y, Z, 0.0, 0.0, A);
            SendClientMessage(playerid, COLOR_GREEN, "RoadBlock Successfully Deployed");
        }
        else
        {
            DestroyObject(block[1]);
            block[1] = false;
            SendClientMessage(playerid, COLOR_RED, "RoadBlock Successfully Destroyed");
        }
    }
    else SendClientMessage(playerid, COLOR_RED, "You must be a Cop level 1 or FBI level 2");
    return 1;
}
here a example code
DO NOT COMPILER IT YOU WILL JUST GET ERRORS
you need to replace your Team variable and the teamids with yours
Reply
#9

jeff's code is perfect!
cool I like this command!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)