need help with robbing script
#1

hello am new in scripting and i have came across this script
Код:
new JustRobbed[MAX_PLAYERS]; //Top of your script

forward RobWaitTimer(playerid); //Top of your script
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new giveplayername[MAX_PLAYER_NAME];
    new sendername[MAX_PLAYER_NAME];
    new string[128];

    if(strcmp("/rob", cmdtext, true, 10) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
        if(IsPlayerInAnyVehicle(playerid))
            {
              SendClientMessage(playerid, COLOR_GREY, "You cannot rob someone while being in a Car!");
              return 1;
            }
            new victim = GetClosestPlayer(playerid);
            if(IsPlayerConnected(victim))
            {
              if(JustRobbed[playerid] == 0)
              {
                    if(GetDistanceBetweenPlayers(playerid,victim) < 5)
                    {
                      if(IsPlayerInAnyVehicle(victim))
                      {
                        SendClientMessage(playerid, COLOR_GREY, "You cannot rob someone who is in a car!");
                        return 1;
                      }
                      GetPlayerName(victim, giveplayername, sizeof(giveplayername));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        new randt = random(4)+1;
                        if(randt == 1)
                        {
                          format(string, sizeof(string), "* %s shoots with his Tazer at %s, but missed.", sendername ,giveplayername);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        }
                        else
                        {
                            format(string, sizeof(string), "* You were robbed by %s.", sendername);
                            SendClientMessage(victim, COLOR_WHITE, string);
                            format(string, sizeof(string), "* You robbed %s and stole $$s.", giveplayername, GetPlayerMoney(victim));
                            SendClientMessage(playerid, COLOR_WHITE, string);
                            format(string, sizeof(string), "* %s puts his hand into %s 's pocket and steals his money.", sendername ,giveplayername);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            GameTextForPlayer(victim, "~r~Robbed", 2500, 3);
                            GivePlayerMoney(playerid, GetPlayerMoney(victim));
                            ResetPlayerMoney(victim);
                            JustRobbed[playerid] = 1;
                            SetTimerEx("RobWaitTimer", 2100000, 0, "i", playerid);
                  }
                    }
                    else
                    {
                      SendClientMessage(playerid, COLOR_GREY, "No-one near you!");
                      return 1;
                    }
                }
                else
                {
                  SendClientMessage(playerid, COLOR_GREY, "You can only rob once every 35 minutes!");
                }
            }
        }
        return 1;
    }
    return 0;
}
Код:
public RobWaitTimer(playerid)
{
    JustRobbed[playerid] = 0;
    return 1;
}
from samp webiste in the scripting help froum

and i would like to add it into the Vortex Roleplay 2

but when ever i do compile it i get this error

Код:
C:\Users\user\Desktop\Windows-Server\gamemodes\vx-rp.pwn(629) : warning 217: loose indentation
C:\Users\user\Desktop\Windows-Server\gamemodes\vx-rp.pwn(642) : warning 217: loose indentation
C:\Users\user\Desktop\Windows-Server\gamemodes\vx-rp.pwn(647) : warning 217: loose indentation
C:\Users\user\Desktop\Windows-Server\gamemodes\vx-rp.pwn(647) : error 017: undefined symbol "ProxDetector"
C:\Users\user\Desktop\Windows-Server\gamemodes\vx-rp.pwn(656) : error 017: undefined symbol "ProxDetector"
C:\Users\user\Desktop\Windows-Server\gamemodes\vx-rp.pwn(676) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
got two errors with proxdetector i read around the forum but didn't find an answer i hop you guys can help i will surely appreciate it.
Reply
#2

show us line 647 and 656
Reply
#3

thanx for replaying

line 647
Код:
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
line 656
Код:
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
Reply
#4

Change the ProxDetector lines to:
Код:
nearByMessage(playerid, COLOR_PURPLE, string);
ProxDetector is not defined in the Vortex script, it uses that function instead. As for the loose indentation, make sure that lines 629 642 647 and 676 are tabbed in line and there is not an extra space or space missing from them.
Reply
#5

It appears that you don't have ProxDetector defined. You need to add this function to your script in order to use it.
Reply
#6

Quote:
Originally Posted by aintaro
Посмотреть сообщение
Change the ProxDetector lines to:
Код:
nearByMessage(playerid, COLOR_PURPLE, string);
ProxDetector is not defined in the Vortex script, it uses that function instead. As for the loose indentation, make sure that lines 629 642 647 and 676 are tabbed in line and there is not an extra space or space missing from them.
thnx it fix my error but put me into another problem now when i do /rob command it do the rob animtion but nothing else happend like its stuck there

screen shot



Quote:
Originally Posted by _Vortex
Посмотреть сообщение
It appears that you don't have ProxDetector defined. You need to add this function to your script in order to use it.
am sorry but am not sure how to that didn't find it in wiki hop you could show me please
Reply
#7

Quote:
Originally Posted by _Vortex
Посмотреть сообщение
It appears that you don't have ProxDetector defined. You need to add this function to your script in order to use it.




i have defined ProxDetector as u told me, but i end up with the same problem when i do the /rob command it activate the animation n stuck there only.

thanx both btw u made me learn something new and also made me go one step foreword but i got stuck again.


it didnt work only the animation am still trying to fix that.

when i compile it i get this

Код:
C:\Users\user\Desktop\Windows-Server\gamemodes\vx-rp.pwn(647) : warning 215: expression has no effect
C:\Users\user\Desktop\Windows-Server\gamemodes\vx-rp.pwn(656) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
both lines of 656 647 are for ProxDetector
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)