Adding to this command?
#1

I want this command (/drag PLAYERID):
Код:
	if(strcmp(cmd, "/drag", true) == 0) // by Ellis
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(!IsACop(playerid))
			{
			  SendClientMessage(playerid, COLOR_GRAD1, "You are not a cop!");
			  return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /drag [playerid/PartOfName]");
				return 1;
			}
			new newcar = GetPlayerVehicleID(playerid);
			new dragged;
			dragged = ReturnUser(tmp);
			if(IsACopCar(newcar) || IsNgCar(newcar) || IsAnFbiCar(newcar))
			{
			  if(IsPlayerConnected(dragged))
			  {
			    if(dragged != INVALID_PLAYER_ID)
			    {
			      new Float:x, Float:y, Float:z;
			      GetPlayerPos(dragged,x,y,z);
			      if(PlayerToPoint(5, playerid, x, y, z))
			      {
			      	PutPlayerInVehicle(dragged,newcar,1);
			      	GetPlayerName(dragged, giveplayer, sizeof(giveplayer));
							GetPlayerName(playerid, sendername, sizeof(sendername));
							format(string, sizeof(string), "%s drags %s to their vehicle.", sendername ,giveplayer);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						}
						else
						{
							SendClientMessage(playerid, COLOR_GREY, "Player is not near you.");
						}
					}
			  }
			}
			else
			{
			  SendClientMessage(playerid, COLOR_GRAD1, "You are not in police vehicle!");
			}
	  }
	  return 1;
	}
To be /drag PLAYERID SEATID, and I want it to only work if you are 3m away from a police vehicle, not if you are inside.
So basically, it would use this:
Код:
  PutPlayerInVehicle(dragged, vehicleid, seatid);
But I don't know how to detect the nearest car.
Reply
#2

Doesn't take a big change
pawn Код:
if(strcmp(cmd, "/drag", true) == 0) // by Ellis
    {
      new tmpseat;
      if(IsPlayerConnected(playerid))//Most redudant code on the freaking planet! What player types a command in and ISN'T connected to the server?
      {
        if(!IsACop(playerid))
            {
              SendClientMessage(playerid, COLOR_GRAD1, "You are not a cop!");
              return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /drag [playerid/PartOfName] [seatid <1-3>]");
                return 1;
            }
            tmpseat = strtok(cmdtext, idx);
            if(!strlen(tmpseat)|| ( (strval(tmpseat)>3)||(strval(tmpseat)<1) ) )
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /drag [playerid/PartOfName] [seatid <1-3>]");
                return 1;
            }
            new newcar = GetPlayerVehicleID(playerid);
            new dragged;
            dragged = ReturnUser(tmp);
            if(IsACopCar(newcar) || IsNgCar(newcar) || IsAnFbiCar(newcar))
            {
              if(IsPlayerConnected(dragged))
              {
                if(dragged != INVALID_PLAYER_ID)
                {
                  new Float:x, Float:y, Float:z;
                  GetPlayerPos(dragged,x,y,z);
                  if(PlayerToPoint(5, playerid, x, y, z))
                  {
                    PutPlayerInVehicle(dragged,newcar,strval(tmpseat));
                    GetPlayerName(dragged, giveplayer, sizeof(giveplayer));
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            format(string, sizeof(string), "%s drags %s to their vehicle.", sendername ,giveplayer);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "Player is not near you.");
                        }
                    }
              }
            }
            else
            {
              SendClientMessage(playerid, COLOR_GRAD1, "You are not in police vehicle!");
            }
      }
      return 1;
    }
Reply
#3

Код:
C:\Users\James\Desktop\SAMP\gamemodes\gtarp.pwn(12964) : error 006: must be assigned to an array
C:\Users\James\Desktop\SAMP\gamemodes\gtarp.pwn(12965) : error 035: argument type mismatch (argument 1)
C:\Users\James\Desktop\SAMP\gamemodes\gtarp.pwn(12983) : error 035: argument type mismatch (argument 1)
C:\Users\James\Desktop\SAMP\gamemodes\gtarp.pwn(12964) : warning 204: symbol is assigned a value that is never used: "tmpseat"
Line 12964:
Код:
			tmpseat = strtok(cmdtext, idx);
Line 12965:
Код:
			if(!strlen(tmpseat)|| ( (strval(tmpseat)>3)||(strval(tmpseat)<1) ) )
Line 12983:
Код:
			      	PutPlayerInVehicle(dragged,newcar,strval(tmpseat));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)