it is possible
#1

guys it is possible to detect if the player is in watter or to remove some object of the map ? :/
Reply
#2

Yes it is possible to detect if a player is in the water. And you can't remove orginal objects from the map.
Reply
#3

Meh, I found this in Useful functions when I did a search:

pawn Код:
stock IsPlayerInWater(playerid)
{
    new animlib[32],tmp[32];
    GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,tmp,32);
    if( !strcmp(animlib, "SWIM") && !IsPlayerInAnyVehicle(playerid) ) return true;
    return false;
}
Reply
#4

i want to make if the player is not in water to cant spawn a boat and if he is in watter he can spawn boat but not cars how i can do that ?
Reply
#5

pawn Код:
CMD:boat(playerid, cmdtext[])
{
    if (!IsPlayerInWater(playerid)) return SendClientMessage(playerid, -1, "You have to be in water to use this command.");
    new V, Float:pos[4];
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    GetPlayerFacingAngle(playerid, pos[3]);
    V = CreateVehicle(446, pos[0], pos[1], pos[2], pos[3], -1, -1, 1000);
    PutPlayerInVehicle(playerid, V, 0);
    SendClientMessage(playerid, -1, "Enjoy your boat mate! ;)");
    return true;
}
Untested, but it should work.
Reply
#6

dude i think dont have code IsPlayerInWater if have i will maked
Reply
#7

Quote:
Originally Posted by Rafa
Посмотреть сообщение
dude i think dont have code IsPlayerInWater if have i will maked
lol, look up, I gave you the code (IsPlayerInWater) already.
Reply
#8

pawn Код:
stock IsPlayerInWater(playerid)
{
       new animlib[32],tmp[32];
       GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,tmp,32);
       if(!strcmp(animlib, "SWIM") && !IsPlayerInAnyVehicle(playerid)) return true;
       return false;
}

public IsABoat(carid)
{
       new modelid = GetVehicleModel(carid);
       if(modelid == 430 || modelid == 446 || modelid == 452 || modelid == 453 || modelid == 454 || modelid == 472 || modelid == 473 || modelid == 484 || modelid == 493 || modelid == 595)
       {
              return 1;
       }
       return 0;
}

CMD:vehicle(playerid, params[])
{
       new model;
       new Float:pos[4];
       new veh;
       if(sscanf(params, "i", model)) {
              SendClientMessage(playerid, -1, "Usage: /vehicle [model]");
       } else {
              GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
              GetPlayerFacingAngle(playerid, pos[3]);
              if(IsPlayerInWater(playerid)) {
                      if(IsABoat(model)) {
                              SendClientMessage(playerid, -1, "Enjoy your vehicle.");
                              veh = CreateVehicle(model, pos[0], pos[1], pos[2], pos[3], -1, -1, 1000);
                              PutPlayerInVehicle(playerid, veh, 0);
                      } else SendClientMessage(playerid, -1, "You can only spawn boats in water.");
              } else {
                      if(!IsABoat(model)) {
                              SendClientMessage(playerid, -1, "Enjoy your vehicle.");
                              veh = CreateVehicle(model, pos[0], pos[1], pos[2], pos[3], -1, -1, 1000);
                              PutPlayerInVehicle(playerid, veh, 0);
                      } else SendClientMessage(playerid, -1, "You can only spawn boats in water.");
              }
}
Reply
#9

lol oh thanks mate now ill test xD
Reply
#10

My version is a lot more detailed than iPLEOMAX's, go ingame and type /vehicle
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)