Author Topic: Need Help? Ask it here!  (Read 92431 times)

0 Members and 1 Guest are viewing this topic.

Offline Faraday

  • The Scranton Strangler
  • SA-MP Retirees
  • *
  • *
  • *
  • Posts: 2599
  • Super[M]unkey
    • Awards
Re: Need Help? Ask it here!
« Reply #60 on: December 02, 2012, 01:49:32 PM »
Seems like you just toggle the playerid controllable. If you want to unfreeze all of the players you'll have to loop through all the players and search for those in the minigame and unfreeze them.


it'll probably look like this:
Code: [Select]
for( new i = 0; i < MAX_PLAYERS; i++)
{
    if( IsPlayerInMinigame[ i ] ) //==> fill in your variable/bool whatever
          TogglePlayerControllable( i, 1 );
}

Offline Jellyfish

  • VC-MP Retirees
  • *
  • *
  • Posts: 98
    • Awards
Re: Need Help? Ask it here!
« Reply #61 on: December 11, 2012, 12:37:25 PM »
This may not be the correct place to post it but I'm not where else I can. I want to start learning SAMP (PAWN(?)) scripting, I have no previous experience and no idea how it's done, but I'm quite willing so throw everything you've got at me.

Offline Faraday

  • The Scranton Strangler
  • SA-MP Retirees
  • *
  • *
  • *
  • Posts: 2599
  • Super[M]unkey
    • Awards
Re: Need Help? Ask it here!
« Reply #62 on: December 11, 2012, 02:25:06 PM »

Offline PawnFox

  • SA-MP
  • SA-MP Retirees
  • *
  • Posts: 1998
  • 187 Co.
    • Awards
Re: Need Help? Ask it here!
« Reply #63 on: December 11, 2012, 09:48:02 PM »

Offline Talha Khan

  • SA-MP Donator
  • *
  • Posts: 205
  • My ambition is handicapped by LAZINESS.
    • Awards
  • SA-MP: [HC]Mr.Khan
Re: Need Help? Ask it here!
« Reply #64 on: September 15, 2016, 08:10:29 PM »
Code: [Select]
dcmd_dv(playerid, params[])
{
    #pragma unused params
    new vehicleid;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_WHITE,"SERVER: Unknown command");
    else if(!IsPlayerInVehicle(playerid, vehicleid)) return SendClientMessage(playerid,COLOR_RED,"ERROR:You Must Be In A Vehicle");
    if(IsPlayerAdmin(playerid))
if(IsPlayerInVehicle(playerid, vehicleid))
{
    SendClientMessage(playerid,COLOR_RED,"Vehicle Removed");
    return DestroyVehicle(GetPlayerVehicleID(playerid));
    }
    return 1;
}
ok so i was making some commands but got a problem all other commands are working but not this one i want to make a command like /dv to destroy vehicle only for admins so if a player use it he gets unknown command message which is fine and when an admin use it on foot he gets ERROR:You Must Be In A Vehicle and if he use it in vehicle the vehicle is removed and he gets Vehicle Removed message
i tried doing everything i know but still getting error in this i get You Must Be In A Vehicle error even if i am in vehicle

Jayce

  • Guest
Re: Need Help? Ask it here!
« Reply #65 on: September 15, 2016, 09:21:25 PM »
Code: [Select]
dcmd_dv(playerid, params[])
{
    #pragma unused params
    new vehicleid;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_WHITE,"SERVER: Unknown command");
    else if(!IsPlayerInVehicle(playerid, vehicleid)) return SendClientMessage(playerid,COLOR_RED,"ERROR:You Must Be In A Vehicle");
    if(IsPlayerAdmin(playerid))
   if(IsPlayerInVehicle(playerid, vehicleid))
   {
    SendClientMessage(playerid,COLOR_RED,"Vehicle Removed");
    return DestroyVehicle(GetPlayerVehicleID(playerid));
    }
    return 1;
}
ok so i was making some commands but got a problem all other commands are working but not this one i want to make a command like /dv to destroy vehicle only for admins so if a player use it he gets unknown command message which is fine and when an admin use it on foot he gets ERROR:You Must Be In A Vehicle and if he use it in vehicle the vehicle is removed and he gets Vehicle Removed message
i tried doing everything i know but still getting error in this i get You Must Be In A Vehicle error even if i am in vehicle


You were checking if the player is in the vehicle ID stored in the vehicleid variable (which is 0) so it always returns false. You should use IsPlayerInAnyVehicle instead.
Code: [Select]
dcmd_dv(playerid, params[])
{
    #pragma unused params


    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_WHITE,"SERVER: Unknown command");


    if(IsPlayerInAnyVehicle(playerid))
    {
        SendClientMessage(playerid,COLOR_RED,"Vehicle Removed");
        return DestroyVehicle(GetPlayerVehicleID(playerid));
    }
    else return SendClientMessage(playerid,COLOR_RED,"ERROR:You Must Be In A Vehicle");

}

edit: WYSIWYG editor sucks.

« Last Edit: September 15, 2016, 09:27:34 PM by Jayce »

Offline Talha Khan

  • SA-MP Donator
  • *
  • Posts: 205
  • My ambition is handicapped by LAZINESS.
    • Awards
  • SA-MP: [HC]Mr.Khan
Re: Need Help? Ask it here!
« Reply #66 on: September 15, 2016, 09:32:03 PM »
Code: [Select]
dcmd_dv(playerid, params[])
{
    #pragma unused params
    new vehicleid;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_WHITE,"SERVER: Unknown command");
    else if(!IsPlayerInVehicle(playerid, vehicleid)) return SendClientMessage(playerid,COLOR_RED,"ERROR:You Must Be In A Vehicle");
    if(IsPlayerAdmin(playerid))
   if(IsPlayerInVehicle(playerid, vehicleid))
   {
    SendClientMessage(playerid,COLOR_RED,"Vehicle Removed");
    return DestroyVehicle(GetPlayerVehicleID(playerid));
    }
    return 1;
}
ok so i was making some commands but got a problem all other commands are working but not this one i want to make a command like /dv to destroy vehicle only for admins so if a player use it he gets unknown command message which is fine and when an admin use it on foot he gets ERROR:You Must Be In A Vehicle and if he use it in vehicle the vehicle is removed and he gets Vehicle Removed message
i tried doing everything i know but still getting error in this i get You Must Be In A Vehicle error even if i am in vehicle


You were checking if the player is in the vehicle ID stored in the vehicleid variable (which is 0) so it always returns false. You should use IsPlayerInAnyVehicle instead.
Code: [Select]
dcmd_dv(playerid, params[])
{
    #pragma unused params


    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_WHITE,"SERVER: Unknown command");


    if(IsPlayerInAnyVehicle(playerid))
    {
        SendClientMessage(playerid,COLOR_RED,"Vehicle Removed");
        return DestroyVehicle(GetPlayerVehicleID(playerid));
    }
    else return SendClientMessage(playerid,COLOR_RED,"ERROR:You Must Be In A Vehicle");

}

edit: WYSIWYG editor sucks.
great thanks it worked :)