SA-MP Forums Archive
help with command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: help with command (/showthread.php?tid=430925)



help with command - icko202 - 15.04.2013

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


Re: help with command - Blast3r - 15.04.2013

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;
    }



Re: help with command - icko202 - 16.04.2013

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


AW: help with command - ulbi1990 - 16.04.2013

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;
}



Re: AW: help with command - TomatoRage - 16.04.2013

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


AW: help with command - ulbi1990 - 16.04.2013

@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".