Need help with /detain command
#1

Код:
if (!strcmp(cmd, "/pullincar", true))
			if(IsACop(playerid) || IsAFreecop(playerid))
		{
  tmp = strtok(cmdtext, idx);
  if (!strlen(tmp))
    return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /pullincar [player id] [seatid]");
  new person = strval(tmp);
  tmp = strtok(cmdtext, idx);
  if (!strlen(tmp))
    return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /pullincar [player id] [seatid]");
  new seat = strval(tmp);
  new Float:pos[6];
  GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  GetPlayerPos(playerid, pos[3], pos[4], pos[5]);
  if (floatcmp(floatabs(floatsub(pos[0], pos[3])), 10.0) != -1 &&
  floatcmp(floatabs(floatsub(pos[1], pos[4])), 10.0) != -1 &&
  floatcmp(floatabs(floatsub(pos[2], pos[5])), 10.0) != -1) return false;
  PutPlayerInVehicle(person, GetPlayerVehicleID(playerid), seat);
  return 1;
}
Hey guys here is a simple command I have and for some reason it does not pull the person in a car. I am a cop and on duty but it still won't drag the player in any of the 3 seats.

Any help is appreciated
Reply
#2

bump
Reply
#3

i don't know how strtok works
pawn Код:
if (!strcmp(cmd, "/pullincar", true))
{
    if(IsACop(playerid) || IsAFreecop(playerid))
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /pullincar [player id] [seatid]");
        new person = strval(tmp);
        if(person < 0 || person >= MAX_PLAYERS) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /pullincar [player id] [seatid]");
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /pullincar [player id] [seatid]");
        new seat = strval(tmp), Float:pos[3];
        GetPlayerPos(person, pos[0], pos[1], pos[2]);
        if(GetPlayerDistanceFromPoint(playerid, pos[0], pos[1], pos[2]) > 15.0) return false;
        PutPlayerInVehicle(person, GetPlayerVehicleID(playerid), seat);
    }
    return 1;
}
Reply
#4

Quote:

C:\Users\Administrator\Desktop\East Coast Roleplay\gamemodes\larp.pwn(6785 : error 017: undefined symbol "GetPlayerDistanceToPoint"

Got this error, Can I have your GetPlayerDistanceToPoint method?
Reply
#5

Still need help with this, anyone willing to help?
Reply
#6

pawn Код:
if (!strcmp(cmd, "/pullincar", true))
{
    if(IsACop(playerid) || IsAFreecop(playerid))
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /pullincar [player id] [seatid]");
        new person = strval(tmp);
        if(person < 0 || person >= MAX_PLAYERS) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /pullincar [player id] [seatid]");
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /pullincar [player id] [seatid]");
        new seat = strval(tmp), Float:pos[3];
        GetPlayerPos(person, pos[0], pos[1], pos[2]);
        PutPlayerInVehicle(person, GetPlayerVehicleID(playerid), seat);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)