help with command
#1

How can i made this command:

if(strcmp(cmdtext,"/buygun",true)==0)
{
if(IsPlayerInRangeOfPoint(playerid,5, 1995.9645996094, -1199.5222167969, 19.05354309082))
{
ShowPlayerDialog(playerid, DIALOG_GUN, DIALOG_STYLE_LIST, "Gun Shop", "Deagle - 1000$\n Shotgun - 2500$\n M4A1 - 5000$\n AK47 - 5000$\n Sniper 3000$\n Granade - 1000$\n RPG - 15000$\n Armor - 2500$", "Buy", "Cancel");
}
else
{
SendClientMessage(playerid,0x0000BBAA,"You are not at the gunplace!");
}
return 1;
}

to be used ONLY if u are in car ID 440? otherwise u get an message
Reply
#2

pawn Код:
if(strcmp(cmdtext,"/buygun",true)==0)
    {
          if(GetPlayerVehicleId(playerid) != 440)) return SendClientMessage(playerid,color, "message");
          if(IsPlayerInRangeOfPoint(playerid,5,  1995.9645996094, -1199.5222167969, 19.05354309082))
          {
          ShowPlayerDialog(playerid, DIALOG_GUN, DIALOG_STYLE_LIST, "Gun Shop", "Deagle - 1000$\n Shotgun - 2500$\n M4A1 - 5000$\n AK47 - 5000$\n Sniper 3000$\n Granade - 1000$\n RPG - 15000$\n Armor - 2500$", "Buy", "Cancel");
          }
          else
          {
          SendClientMessage(playerid,0x0000BBAA,"You are not at the gunplace!");
          }
          return 1;
    }
Try that, not sure if I used GetPlayerVehicleID right since I never scripted smthing to check the vehicle ID, hope it works.

EDIT: If you want it to be used in the vehicle at any location, do this:

pawn Код:
if(strcmp(cmdtext,"/buygun",true)==0)
    {
          if(GetPlayerVehicleId(playerid) == 440))
          {
          ShowPlayerDialog(playerid, DIALOG_GUN, DIALOG_STYLE_LIST, "Gun Shop", "Deagle - 1000$\n Shotgun - 2500$\n M4A1 - 5000$\n AK47 - 5000$\n Sniper 3000$\n Granade - 1000$\n RPG - 15000$\n Armor - 2500$", "Buy", "Cancel");
          }
          else
          {
          SendClientMessage(playerid,0x0000BBAA,"You are not at the gunplace!");
          }
          return 1;
    }
Reply
#3

i get this:
C:\Users\DELL\Desktop\TDM v0.3\gamemodes\tdm.pwn(405) : error 017: undefined symbol "GetPlayerVehicleId"
C:\Users\DELL\Desktop\TDM v0.3\gamemodes\tdm.pwn(405) : error 029: invalid expression, assumed zero
C:\Users\DELL\Desktop\TDM v0.3\gamemodes\tdm.pwn(405) : warning 215: expression has no effect
C:\Users\DELL\Desktop\TDM v0.3\gamemodes\tdm.pwn(405) : error 001: expected token: ";", but found "return"
C:\Users\DELL\Desktop\TDM v0.3\gamemodes\tdm.pwn(405) : fatal error 107: too many error messages on one line
Reply
#4

pawn Код:
if(strcmp(cmdtext,"/buygun",true)==0)
{
    if(IsPlayerInRangeOfPoint(playerid,5, 1995.9645996094, -1199.5222167969, 19.05354309082))
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 440))
        {
            ShowPlayerDialog(playerid, DIALOG_GUN, DIALOG_STYLE_LIST, "Gun Shop", "Deagle - 1000$\n Shotgun - 2500$\n M4A1 - 5000$\n AK47 - 5000$\n Sniper 3000$\n Granade - 1000$\n RPG - 15000$\n Armor - 2500$", "Buy", "Cancel");
        }
        else
        {
            SendClientMessage(playerid,0x0000BBAA,"Your not in the vehicle ID 440!");
        }
    }
    else
    {
        SendClientMessage(playerid,0x0000BBAA,"You are not at the gunplace!");
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by ulbi1990
Посмотреть сообщение
pawn Код:
if(strcmp(cmdtext,"/buygun",true)==0)
{
    if(IsPlayerInRangeOfPoint(playerid,5, 1995.9645996094, -1199.5222167969, 19.05354309082))
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 440))
        {
            ShowPlayerDialog(playerid, DIALOG_GUN, DIALOG_STYLE_LIST, "Gun Shop", "Deagle - 1000$\n Shotgun - 2500$\n M4A1 - 5000$\n AK47 - 5000$\n Sniper 3000$\n Granade - 1000$\n RPG - 15000$\n Armor - 2500$", "Buy", "Cancel");
        return 1;
        }
        else
        {
            SendClientMessage(playerid,0x0000BBAA,"Your not in the vehicle ID 440!");
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid,0x0000BBAA,"You are not at the gunplace!")
    }
    return 1;
}
Fixed
Reply
#6

@TomatoRage wtf are u doing? Learn Pawn before you write such a wrong code, my code works 100% it's tested so don't edit anything and write "Fixed".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)