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

0 Members and 1 Guest are viewing this topic.

Offline Faraday

  • The Scranton Strangler
  • SA-MP Retirees
  • *
  • Posts: 2598
  • 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: 97
    • 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: 2598
  • Super[M]unkey
    • Awards
Re: Need Help? Ask it here!
« Reply #62 on: December 11, 2012, 02:25:06 pm »

Online PawnFox

  • Management
  • *
  • Posts: 1916
  • Awards Littlewhitey's SA-MP Player of the Year 2013
    • 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 username: [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 username: [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 :)