DM error
#1

.........
Reply
#2

ok, i would reccommend to you:

Get A Player Data script (i just knicked mine from Ladmin)

(above on game mode init)

//--ENUMS-----
enum PlayerData
{
DM,
};

//---PINFO-------
new PlayerInfo[MAX_PLAYERS][PlayerData];


for your dm spawn


if(strcmp(cmdtext, "/minigun",true)==0) {
SendClientMessage(playerid,COLOR_RED,"welcome to the minigun zone");
DisableStuntBonusForPlayer(playerid, 1);
PlayerInfo[playerid][DM] += 1;
}

now for your stuntbonus youll want it to fetch whether the player is in a dm zone or not.


Код:
if(strcmp(cmdtext, "/stuntbonus",true)== 0) {
  if(PlayerInfo[playerid][DM] == 0)
  {
     EnableStuntBonusForPlayer(playerid, 1);
     SendClientMessage(playerid, COLOR_AQUA,"Stunt Bonus Enabled !");
  }
  if(PlayerInfo[playerid][DM] == 1)
  {
     SendClientMessage(playerid, COLOR_RED, "You Are in a DM, type /kill or /ifarted to exit !");
  }
  return 1;
}
dont forget, to make sure that you set there dm counter back to 0 on leaving the dm zone.


i.e.

Код:
Public OnPlayerDeath(playerid, killerid, reason)
{
  PlayerInfo[playerid][DM] -= 1;
}


Reply
#3

no i want to add the Error Thing to the End of all Teleports
Reply
#4

help ;s
Reply
#5

hello?? Help!
Reply
#6

Quote:
Originally Posted by [Hunter
]
Hey im trying to Block commands when in DM for example
EDIT: Ok i almost got it to work but now...

pawn Код:
if(strcmp(cmdtext, "/stuntbonus",true)==0) {
EnableStuntBonusForPlayer(playerid, 1);
SendClientMessage(playerid, COLOR_AQUA,"Stunt Bonus Enabled !");
}
return 1;
}
////////////////////////////////////////////////////////////////////////////////////
else
{
SendClientMessage(playerid, COLOR_RED, "You Are in a DM, type /kill or /ifarted to exit !");
}
return 1;
}


but i get this
pawn Код:
C:\Users\Compaq_Administrator\Desktop\All Files\0.2x\gamemodes\Test3.pwn(3329) : error 010: invalid function or declaration
C:\Users\Compaq_Administrator\Desktop\All Files\0.2x\gamemodes\Test3.pwn(3333) : error 010: invalid function or declaration
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
try this:

pawn Код:
if(strcmp(cmdtext, "/stuntbonus",true)==0)
    {
        EnableStuntBonusForPlayer(playerid, 1);
        SendClientMessage(playerid, COLOR_AQUA,"Stunt Bonus Enabled !");
        return 1;
    }
////////////////////////////////////////////////////////////////////////////////////
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You Are in a DM, type /kill or /ifarted to exit !");
        return 1;
    }
Reply
#7

ok i got 1 warning

Let say..... this is the last command

pawn Код:
if(strcmp(cmdtext, "/nrg", true)==0)
            {
            if( PVeh[playerid] > 0 )
            {
            if(GetPlayerVehicleID(playerid) != PVeh[playerid])
            {
            if(IsPlayerInAnyVehicle(playerid))
            {
            RemovePlayerFromVehicle(playerid);
            }
            new Float: X, Float: Y, Float: Z, Float: Ang, Name[30];
            GetPlayerPos(playerid, X, Y, Z);
            GetPlayerFacingAngle(playerid, Ang);
            GetPlayerName(playerid, Name, sizeof( Name ));
            PutPlayerInVehicle(playerid, PVeh[playerid], 0);
            SetVehiclePos(PVeh[playerid], X, Y, Z);
            SetVehicleZAngle(PVeh[playerid], Ang);
            SetVehicleHealth(PVeh[playerid], 1000.0);
            LinkVehicleToInterior(PVeh[playerid], GetPlayerInterior(playerid));
            SendClientMessage(playerid,COLOR_GREEN, "personal nrg called.");
            PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
            }
            else
            {
            SendClientMessage(playerid,COLOR_RED, "You are already on your personal nrg.");
            }
            }
            else
            {
            if(IsPlayerInAnyVehicle(playerid))
            {
            RemovePlayerFromVehicle(playerid);
            }
            new Float: X, Float: Y, Float: Z, Float: Ang, Name[30];
            GetPlayerPos(playerid, X, Y, Z);
            GetPlayerFacingAngle(playerid, Ang);
            GetPlayerName(playerid, Name, sizeof( Name ));
            PVeh[playerid] = CreateVehicle(522, X, Y , Z, Ang, 75,3, 5000000);
            PutPlayerInVehicle(playerid, PVeh[playerid], 0);
            LinkVehicleToInterior(PVeh[playerid], GetPlayerInterior(playerid));
            printf("personal nrg created for %s.", Name);
            SendClientMessage(playerid,COLOR_GREEN, "personal nrg created.");
            PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
            SetVehicleParamsForPlayer(PVeh[playerid], playerid, 0, 0);
            for(new i=0; i <= MAX_PLAYERS; i++)
            {
            if ( IsPlayerConnected(i) )
            {
            if ( i != playerid )
            {
            SetVehicleParamsForPlayer(PVeh[playerid], i, 0, 1);
            }
            }
            }
            }
            return 1;
            }
            else
            {
            SendClientMessage(playerid, COLOR_RED, "You Are in a DM, type /kill or /ifarted to exit !");
            return 1;
            }
            new string[128];
            format(string, sizeof(string), "I have scanned -- %s but its not a availabaile, please check your spelling and try again or /tele and /teles.", cmdtext);
            return SendClientMessage(playerid, COLOR_GREY, string);
            }
Now i get a Warning

pawn Код:
C:\Users\Compaq_Administrator\Desktop\All Files\0.2x\gamemodes\Test3.pwn(3327) : warning 225: unreachable code
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
does it affect anything??

and somehelp thx
Reply
#8

Help
Reply
#9

Mark the line that that error is on, I cba to read though it all lol
Reply
#10

pawn Код:
ok this is the warning

            if(strcmp(cmdtext, "/nrg", true)==0)
            {
            if( PVeh[playerid] > 0 )
            {
            if(GetPlayerVehicleID(playerid) != PVeh[playerid])
            {
            if(IsPlayerInAnyVehicle(playerid))
            {
            RemovePlayerFromVehicle(playerid);
            }
            new Float: X, Float: Y, Float: Z, Float: Ang, Name[30];
            GetPlayerPos(playerid, X, Y, Z);
            GetPlayerFacingAngle(playerid, Ang);
            GetPlayerName(playerid, Name, sizeof( Name ));
            PutPlayerInVehicle(playerid, PVeh[playerid], 0);
            SetVehiclePos(PVeh[playerid], X, Y, Z);
            SetVehicleZAngle(PVeh[playerid], Ang);
            SetVehicleHealth(PVeh[playerid], 1000.0);
            LinkVehicleToInterior(PVeh[playerid], GetPlayerInterior(playerid));
            SendClientMessage(playerid,COLOR_GREEN, "personal nrg called.");
            PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
            }
            else
            {
            SendClientMessage(playerid,COLOR_RED, "You are already on your personal nrg.");
            }
            }
            else
            {
            if(IsPlayerInAnyVehicle(playerid))
            {
            RemovePlayerFromVehicle(playerid);
            }
            new Float: X, Float: Y, Float: Z, Float: Ang, Name[30];
            GetPlayerPos(playerid, X, Y, Z);
            GetPlayerFacingAngle(playerid, Ang);
            GetPlayerName(playerid, Name, sizeof( Name ));
            PVeh[playerid] = CreateVehicle(522, X, Y , Z, Ang, 75,3, 5000000);
            PutPlayerInVehicle(playerid, PVeh[playerid], 0);
            LinkVehicleToInterior(PVeh[playerid], GetPlayerInterior(playerid));
            printf("personal nrg created for %s.", Name);
            SendClientMessage(playerid,COLOR_GREEN, "personal nrg created.");
            PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
            SetVehicleParamsForPlayer(PVeh[playerid], playerid, 0, 0);
            for(new i=0; i <= MAX_PLAYERS; i++)
            {
            if ( IsPlayerConnected(i) )
            {
            if ( i != playerid )
            {
            SetVehicleParamsForPlayer(PVeh[playerid], i, 0, 1);
            }
            }
            }
            }
            return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "You Are in a DM, type /kill or /ifarted to exit !");
return 1;
}
new string[128]; // <------ This is were the pawn complier detects the warning/////
format(string, sizeof(string), "I have scanned -- %s but its not a availabaile, please check your spelling and try again or /tele and /teles.", cmdtext);
return SendClientMessage(playerid, COLOR_GREY, string);
}
look at the end and you will see it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)