CMD: drag
#1

How i can do it drag the suspect to last car i want help please

Код:
CMD:drag(playerid,params[])
{
      if(gTeam[playerid] == Swat)
      {
        new id, Float:x,Float:y,Float:z,tname[MAX_PLAYER_NAME];
        if(sscanf(params, "d", id)) return SendClientMessage(playerid, -1,"{ff0000}[USAGE]: {ffffff}/drag [ID]");
        if(GetPlayerWantedLevel(id) >= 4)
        {
			if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"{ff0000}[ERROR]: {ffffff}This player isn't online!");
			if(playerid == id) return SendClientMessage(playerid, -1, "{ff0000}[ERROR]: {ffffff}You can't drag your self");
			if(!IsPlayerAttachedObjectSlotUsed(id, 0)) return SendClientMessage(playerid,RED,"{ff0000}[ERROR]: {ffffff}The player must be cuffed to use this command on him.");
			GetPlayerPos(playerid, x, y, z);
			if(IsPlayerInRangeOfPoint(id, 5.0, x, y, z))
			{
	   					if(IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, RED,"{ff0000}[ERROR]: {ffffff}This player is in vehicle, Try to get him out, then re-use the command.");
	   					if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, RED,"{ff0000}[ERROR]: {ffffff}You must be in a vehcile to use this command.");
	   					PutPlayerInVehicle(id, GetPlayerVehicleID(playerid), 1);
	   					TogglePlayerControllable(id, 0);
						GetPlayerName(id,tname,sizeof(tname));
						format(Jstring,sizeof(Jstring)," {00FFFFFF}[SWAT COMMAND]:{ffffff} You have dragged the player: %s(%d) succesfully, take him to the check point.",tname,id);
						SendClientMessage(playerid,SwatC,Jstring);
			}
        } else return SendClientMessage(playerid,-1,"{ff0000}[ERROR]: {ffffff}This player isn't wanted.");
      } else return SendClientMessage(playerid, RED,"{ff0000}[ERROR]: {ffffff}You have to be in the S.W.A.T skin to use this command.");
      return 1;
}
Reply
#2

Last car requires more work in code that you haven't provided.

After all, lastcar cannot be found via this command, it needs a global variable which gets changed as people enter/exit cars.

You'll want to be looking over some of the tutorials before signing up and asking people to do what you want in your script.

There's a section for that... https://sampforum.blast.hk/showthread.php?tid=447813
Reply
#3

new LastCar[MAX_PLAYERS];

OnPlayerStateChange -> if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT) -> get vehicle id and store the id in LastCar[playerid] .
Reply
#4

Quote:
Originally Posted by PepsiCola23
Посмотреть сообщение
Terrible paste of random code
If you're going to call people out on what they should and shouldn't post, then you shouldn't be pasting up code to those who aren't learning, or even trying to follow the rules, or the forum guidelines..
Reply
#5

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
If you're going to call people out on what they should and shouldn't post, then you shouldn't be pasting up code to those who aren't learning, or even trying to follow the rules, or the forum guidelines..
i didn`t paste any code,i just wrote it rofl.and may i ask what was wrong about it?I just told him how to get the last cars id
Reply
#6

Quote:
Originally Posted by PepsiCola23
Посмотреть сообщение
i didn`t paste any code,i just wrote it rofl.and may i ask what was wrong about it?I just told him how to get the last cars id
You've pasted up code... You're encouraging people to come here demanding people to write code for them and to ignore what the more experienced of us, recommend.

You're encouraging this place to continue divulging into a copy-paste hell.


Feeding people this, will ONLY result in UNGRATEFUL ABUSIVE people when they don't get what they demand.


This is why the forum requires you to post up code, and to actually attempt to do things rather than expecting people to post up code to 'help' when it does nothing in the slightest to teach them anything, except for how to con people into giving you what you want when others say it's not what this forum is actually for.
Reply
#7

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
You've pasted up code... You're encouraging people to come here demanding people to write code for them and to ignore what the more experienced of us, recommend.

You're encouraging this place to continue divulging into a copy-paste hell.


Feeding people this, will ONLY result in UNGRATEFUL ABUSIVE people when they don't get what they demand.


This is why the forum requires you to post up code, and to actually attempt to do things rather than expecting people to post up code to 'help' when it does nothing in the slightest to teach them anything, except for how to con people into giving you what you want when others say it's not what this forum is actually for.
i didn`t give him the entire CMD.i just told him how to get the last cars id with "->" instead of words.
if you are so angry stop replying please and take a break,a glass of water might help you.
you are talking about me,but look at you arguing on everything thats not worth it.
Have a nice day buddy and lets stop the chat .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)