Commands stopped working!
#1

Hello!
Well I am new to scripting and i made a teleport there is the script


pawn Code:
//Teleports
if(!strcmp(cmdtext, "/lspd", true)==0)
{
  if(IsPlayerInAnyVehicle(playerid))
  {
    SetVehiclePos(GetPlayerVehicleID(playerid), 1539.2361,-1690.5590,13.5469);
  }
  else
  {
    SetPlayerPos(playerid, 1547.6527,-1675.9519,14.1797);
  }
  SendClientMessage(playerid, 0x000000FF, "You have travelled to LSPD.");
  return 1;
}

//End Teleports

                if(strcmp(cmdtext,"/pd",true)==0)
    {
    new vehicleid = GetPlayerVehicleID(playerid);
    new State = GetPlayerState(playerid);
    if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)
    {
    LinkVehicleToInterior(vehicleid,0);
    SetPlayerInterior(playerid,0) ;
    return SetVehiclePos(vehicleid,1539.2361,-1690.5590,13.5469);
    }
    SetPlayerPos(playerid,1547.6527,-1675.9519,14.1797);
    SetPlayerInterior(playerid,0);
    return 1;
    }
And it worked in the begining but now it has just stopped another thing is i cant add admin house scripts. My server thing says it loaded the script but the houses are never there. What is going wrong? I am using v-admin and LSPD gates
Reply
#2

Please use [ pawn ] tags.
Reply
#3

Well for the lspd command theres an error.
pawn Code:
if(!strcmp(cmdtext, "/lspd", true) == 0)
Basicly here what you saying is
pawn Code:
if(NOTstrcmp(cmdtext, "/lspd", true) == 0)
So remove the ! for starters.
Reply
#4

Still didnt work Removed the ! please help
Reply
#5

I tested both of these and they work. This would have something to do with what you did. I would review the last thing you did, undo that try them again. They work mate. Out of curiosity what was the last thing you did?.
Reply
#6

only that forces a command to return 0 even though it isn't scripted is the calling of a bad variable.

i.e.
new Tacos[5];

Tacos[6] = 1337;
Reply
#7

Ok well here is my whole script

pawn Code:
#include <a_samp>
#include <core>
#include <float>

#pragma tabsize 0

#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define PocketMoney 50000 // Amount player recieves on spawn.
#define INACTIVE_PLAYER_ID 255
#define GIVECASH_DELAY 5000 // Time in ms between /givecash commands.

#define NUMVALUES 4

forward MoneyGrubScoreUpdate();
forward Givecashdelaytimer(playerid);
forward SetPlayerRandomSpawn(playerid);
forward SetupPlayerForClassSelection(playerid);
forward GameModeExitFunc();
forward SendPlayerFormattedText(playerid, const str[], define);
forward public SendAllFormattedText(playerid, const str[], define);

//------------------------------------------------------------------------------------------------------

new CashScoreOld;
new iSpawnSet[MAX_PLAYERS];


new Float:gRandomPlayerSpawns[2][3] = {
{2229.0200,-1159.8000,25.798},
{2229.0200,-1159.8000,25.798}
};

new Float:gCopPlayerSpawns[2][3] = {
{1544.1582,-1676.4047,13.5988},
{1544.1582,-1676.4047,13.5988}
};

//Round code stolen from mike's Manhunt :P
//new gRoundTime = 3600000;          // Round time - 1 hour
//new gRoundTime = 1200000;                 // Round time - 20 mins
//new gRoundTime = 900000;                  // Round time - 15 mins
//new gRoundTime = 600000;                  // Round time - 10 mins
//new gRoundTime = 300000;                  // Round time - 5 mins
//new gRoundTime = 120000;                  // Round time - 2 mins
//new gRoundTime = 60000;                   // Round time - 1 min

new gActivePlayers[MAX_PLAYERS];
new gLastGaveCash[MAX_PLAYERS];

//------------------------------------------------------------------------------------------------------

main()
{
        print("\n----------------------------------");
        print(" Running LS ~Roleplay\n");
        print("     Coded By");
        print("      Jax");
        print("----------------------------------\n");
}

//------------------------------------------------------------------------------------------------------

public MoneyGrubScoreUpdate()
{
    new CashScore;
    new name[MAX_PLAYER_NAME];
    //new string[256];
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            GetPlayerName(i, name, sizeof(name));
            CashScore = GetPlayerMoney(i);
            SetPlayerScore(i, CashScore);
            if (CashScore > CashScoreOld)
            {
                CashScoreOld = CashScore;
                //format(string, sizeof(string), "$$$ %s is now in the lead $$$", name);
                //SendClientMessageToAll(COLOR_YELLOW, string);
            }
        }
    }
}

//------------------------------------------------------------------------------------------------------

/*public GrubModeReset()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            SetPlayerScore(i, PocketMoney);
            SetPlayerRandomSpawn(i, classid);
        }
    }

}*/


//------------------------------------------------------------------------------------------------------

public OnPlayerConnect(playerid)
{
    GameTextForPlayer(playerid,"~w~SA-MP: ~r~Los Sanots ~g~Roleplay",5000,5);
    SendPlayerFormattedText(playerid, "Welcome to Los Santos Roleplay, For help type /help.", 0);
    gActivePlayers[playerid]++;
    gLastGaveCash[playerid] = GetTickCount();
    return 1;
}

//------------------------------------------------------------------------------------------------------
public OnPlayerDisconnect(playerid)
{
    gActivePlayers[playerid]--;
}
//------------------------------------------------------------------------------------------------------

public OnPlayerCommandText(playerid, cmdtext[])
{
    new string[256];
    new playermoney;
    new sendername[MAX_PLAYER_NAME];
    new giveplayer[MAX_PLAYER_NAME];
    new cmd[256];
    new giveplayerid, moneys, idx;

    cmd = strtok(cmdtext, idx);

    if(strcmp(cmd, "/help", true) == 0) {
        SendPlayerFormattedText(playerid,"Las Venturas Deathmatch: Money Grub Coded By Jax and the SA-MP Team.",0);
        SendPlayerFormattedText(playerid,"Type: /objective : to find out what to do in this gamemode.",0);
        SendPlayerFormattedText(playerid,"Type: /givecash [playerid] [money-amount] to send money to other players.",0);
        SendPlayerFormattedText(playerid,"Type: /tips : to see some tips from the creator of the gamemode.", 0);
  return 1;
    }
    if(strcmp(cmd, "/objective", true) == 0) {
        SendPlayerFormattedText(playerid,"This gamemode is faily open, there's no specific win / endgame conditions to meet.",0);
        SendPlayerFormattedText(playerid,"In LVDM:Money Grub, when you kill a player, you will receive whatever money they have.",0);
        SendPlayerFormattedText(playerid,"Consequently, if you have lots of money, and you die, your killer gets your cash.",0);
        SendPlayerFormattedText(playerid,"However, you're not forced to kill players for money, you can always gamble in the", 0);
        SendPlayerFormattedText(playerid,"Casino's.", 0);
  return 1;
    }
    if(strcmp(cmd, "/tips", true) == 0) {
        SendPlayerFormattedText(playerid,"Spawning with just a desert eagle might sound lame, however the idea of this",0);
        SendPlayerFormattedText(playerid,"gamemode is to get some cash, get better guns, then go after whoever has the",0);
        SendPlayerFormattedText(playerid,"most cash. Once you've got the most cash, the idea is to stay alive(with the",0);
        SendPlayerFormattedText(playerid,"cash intact)until the game ends, simple right ?", 0);
  return 1;
    }

    if(strcmp(cmd, "/givecash", true) == 0) {
      new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
            return 1;
        }
        giveplayerid = strval(tmp);

        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
            return 1;
        }
        moneys = strval(tmp);

        //printf("givecash_command: %d %d",giveplayerid,moneys);


        if (IsPlayerConnected(giveplayerid)) {
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            playermoney = GetPlayerMoney(playerid);
            if (moneys > 0 && playermoney >= moneys) {
                GivePlayerMoney(playerid, (0 - moneys));
                GivePlayerMoney(giveplayerid, moneys);
                format(string, sizeof(string), "You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
                SendClientMessage(playerid, COLOR_YELLOW, string);
                format(string, sizeof(string), "You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
                SendClientMessage(giveplayerid, COLOR_YELLOW, string);
                printf("%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
            }
            else {
                SendClientMessage(playerid, COLOR_YELLOW, "Invalid transaction amount.");
            }
        }
        else {
                format(string, sizeof(string), "%d is not an active player.", giveplayerid);
                SendClientMessage(playerid, COLOR_YELLOW, string);
            }
        return 1;
    }

    // PROCESS OTHER COMMANDS
    if(strcmp(cmdtext,"/lspd",true)==0)
    {
    new vehicleid = GetPlayerVehicleID(playerid);
    new State = GetPlayerState(playerid);
    if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)
    {
    GameTextForPlayer(playerid,"You have arrived at LSPD",4000,6);
    return SetVehiclePos(vehicleid,1539.2600,-1692.6366,13.5469);
    }
    SetPlayerPos(playerid,1539.2600,-1692.6366,13.5469);
    GameTextForPlayer(playerid,"You have arrived at LSPD",4000,6);
    return 1;
}


    return 0;
}

//------------------------------------------------------------------------------------------------------

public OnPlayerSpawn(playerid)
{
    GivePlayerMoney(playerid, PocketMoney);
    SetPlayerInterior(playerid,0);
    SetPlayerRandomSpawn(playerid);
    TogglePlayerClock(playerid,1);
    return 1;
}

public SetPlayerRandomSpawn(playerid)
{
    if (iSpawnSet[playerid] == 1)
    {
        new rand = random(sizeof(gCopPlayerSpawns));
        SetPlayerPos(playerid, gCopPlayerSpawns[rand][0], gCopPlayerSpawns[rand][1], gCopPlayerSpawns[rand][2]); // Warp the player
        SetPlayerFacingAngle(playerid, 270.0);
  }
  else if (iSpawnSet[playerid] == 0)
  {
        new rand = random(sizeof(gRandomPlayerSpawns));
        SetPlayerPos(playerid, gRandomPlayerSpawns[rand][0], gRandomPlayerSpawns[rand][1], gRandomPlayerSpawns[rand][2]); // Warp the player
    }
    return 1;
}

//------------------------------------------------------------------------------------------------------

public OnPlayerDeath(playerid, killerid, reason)
{
  new playercash;
    if(killerid == INVALID_PLAYER_ID) {
    SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
    ResetPlayerMoney(playerid);
    } else {
        SendDeathMessage(killerid,playerid,reason);
            SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
            playercash = GetPlayerMoney(playerid);
            if (playercash > 0) {
                GivePlayerMoney(killerid, playercash);
                ResetPlayerMoney(playerid);
            }
            else
            {
            }
    }
    return 1;
}

/* public OnPlayerDeath(playerid, killerid, reason)
{  haxed by teh mike
    new name[MAX_PLAYER_NAME];
    new string[256];
    new deathreason[20];
    new playercash;
    GetPlayerName(playerid, name, sizeof(name));
    GetWeaponName(reason, deathreason, 20);
    if (killerid == INVALID_PLAYER_ID) {
      switch (reason) {
            case WEAPON_DROWN:
            {
        format(string, sizeof(string), "*** %s drowned.)", name);
            }
            default:
            {
              if (strlen(deathreason) > 0) {
                    format(string, sizeof(string), "*** %s died. (%s)", name, deathreason);
                } else {
                  format(string, sizeof(string), "*** %s died.", name);
                }
            }
        }
    }
    else {
    new killer[MAX_PLAYER_NAME];
    GetPlayerName(killerid, killer, sizeof(killer));
    if (strlen(deathreason) > 0) {
        format(string, sizeof(string), "*** %s killed %s. (%s)", killer, name, deathreason);
        } else {
                format(string, sizeof(string), "*** %s killed %s.", killer, name);
            }
        }
    SendClientMessageToAll(COLOR_RED, string);
        {
        playercash = GetPlayerMoney(playerid);
        if (playercash > 0)
        {
            GivePlayerMoney(killerid, playercash);
            ResetPlayerMoney(playerid);
        }
        else
        {
        }
    }
    return 1;
}*/


//------------------------------------------------------------------------------------------------------

public OnPlayerRequestClass(playerid, classid)
{
    iSpawnSet[playerid] = 0;
    SetupPlayerForClassSelection(playerid);
    return 1;
}

public SetupPlayerForClassSelection(playerid)
{
    SetPlayerInterior(playerid,14);
    SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
    SetPlayerFacingAngle(playerid, 270.0);
    SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
    SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
}

public GameModeExitFunc()
{
    GameModeExit();
}

public OnGameModeInit()
{
    SetGameModeText("Ventura's DM~MG");

    ShowPlayerMarkers(1);
    ShowNameTags(1);

    // 0.2.2 specific stuff
    //DisableInteriorEnterExits();
    //SetNameTagDrawDistance(10.0);
    //EnableStuntBonusForAll(0);

    /* Was testing the new pickup limit.
    new Float:pickX=2040.0520;
    new Float:pickY=1319.2799;
    new Float:pickZ=10.3779;
    new x=0;
    while(x!=400) {
        AddStaticPickup(1272,2,pickX,pickY,pickZ);
        pickY+=1.0;
        x++;
    }*/


    // Player Class's
    AddPlayerClass(11,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
    AddPlayerClass(265,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
    AddPlayerClass(166,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
    AddPlayerClass(165,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
    AddPlayerClass(113,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
    AddPlayerClass(117,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
    AddPlayerClass(12,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
    AddPlayerClass(121,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);

   
        // civilians

    AddStaticVehicle(405,1550.5129,-1698.0443,13.4235,272.0411,1,1); //
    // airport

    AddStaticVehicle(519,1826.5828,-2623.3286,14.4647,0.0076,1,1); // shamal
    AddStaticVehicle(513,1754.5437,-2626.1521,14.1040,0.0026,21,36); // stunt plane
    AddStaticVehicle(592,2011.1466,-2541.1167,14.7436,87.1560,1,1); // big plane use this one
    AddStaticVehicle(487,1465.9056,-2457.6313,13.6763,359.9925,29,42); // maverick
    //house cars mine!

    AddStaticVehicle(425,1527.3273,-673.3653,95.3297,0.7518,43,0); // hunter at mi house!
    AddStaticVehicle(581,1519.5089,-660.1942,94.3487,359.5371,0,1); //
    AddStaticVehicle(522,1520.8457,-660.1307,94.3133,357.0447,0,1); //
    AddStaticVehicle(541,1526.3124,-659.7787,94.3752,183.0527,0,1); // bullet
    AddStaticVehicle(411,1491.3007,-689.8035,94.4771,181.5295,0,1); // infernouse car
    AddStaticVehicle(411,1504.2054,-689.5900,94.4770,180.6698,0,1); // infernouse car
    AddStaticVehicle(451,1464.7098,-684.7340,94.4559,232.2425,0,1); // turismo
    AddStaticVehicle(409,1465.9437,-681.1161,94.5500,235.6830,0,0); // limo

    //Jefferson cars
    AddStaticVehicle(536,2206.5620,-1165.6588,25.4674,89.8874,12,1); // car1
    AddStaticVehicle(421,2206.7180,-1173.2653,25.6091,91.0351,0,0); // 2
    AddStaticVehicle(575,2205.8604,-1156.9368,25.3392,89.3231,2,3); //
  AddStaticVehicle(496,2218.4910,-1161.5227,25.4428,90.8716,0,0); // blista
    AddStaticVehicle(401,2227.4875,-1177.1389,25.5062,90.4198,0,0); // next
    AddStaticVehicle(507,2228.3108,-1169.7883,25.5673,90.7178,0,0); //
    AddStaticVehicle(540,2228.2100,-1163.0653,25.6313,90.2999,1,1); //
    AddStaticVehicle(602,2228.0222,-1155.9192,25.6196,88.0204,5,5); // cars pinks

    SetTimer("MoneyGrubScoreUpdate", 1000, 1);
    //SetTimer("GameModeExitFunc", gRoundTime, 0);

    return 1;
}

public SendPlayerFormattedText(playerid, const str[], define)
{
    new tmpbuf[256];
    format(tmpbuf, sizeof(tmpbuf), str, define);
    SendClientMessage(playerid, 0xFF004040, tmpbuf);
}

public SendAllFormattedText(playerid, const str[], define)
{
    new tmpbuf[256];
    format(tmpbuf, sizeof(tmpbuf), str, define);
    SendClientMessageToAll(0xFFFF00AA, tmpbuf);
}

strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply
#8

Again I tested this for you and this works. I tested as a filterscript and as game mode. Commands work. If you are using this as filterscript problem could be in your game mode or maybe another filterscript. To rule out it being another filterscript take the rest out of server.cfg and just test that one. If still not working post gamemode in pastebin. I would suggest though you keep track of what you are doing. As you stated it was working so you did something that that caused it to stop working. When you noticed this for the first time you could have undone this and reviewed what was wrong with what you did. I can only guess at what you did but I can confirm the commands in there worked for me.
Reply
#9

Well currently iam using this as my game mode and for some reason it use to show the unknow command thing now it doesnt even give me that
Reply
#10

OMG i found out the problem!! when i removed all of my filescripts and just ran the gamemode the commands started working again
THANK YOU SO MUCH FIR YOUR HELP!!!!!!!!!!! Everyone one you was a great help thank you thank you
Reply
#11

one of those FS probably closed OnPlayerCommandText with "return 1;" instead of "return 0;"
Reply
#12

Quote:
Originally Posted by ShizNator
Well for the lspd command theres an error.
pawn Код:
if(!strcmp(cmdtext, "/lspd", true) == 0)
Basicly here what you saying is
pawn Код:
if(NOTstrcmp(cmdtext, "/lspd", true) == 0)
So remove the ! for starters.
No. That makes it not case sensitive.
Reply
#13

Quote:
Originally Posted by Mikeshake
Quote:
Originally Posted by ShizNator
Well for the lspd command theres an error.
pawn Код:
if(!strcmp(cmdtext, "/lspd", true) == 0)
Basicly here what you saying is
pawn Код:
if(NOTstrcmp(cmdtext, "/lspd", true) == 0)
So remove the ! for starters.
No. That makes it not case sensitive.
what?

The 3rd param is the bool for case sensitive, not the !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)