SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 27/12/2011, 12:21 AM   #1
Super_Panda
Big Clucker
 
Join Date: Sep 2011
Posts: 147
Reputation: 0
Default OnPlayerEnter&ExitVehcile

pawn Code:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    SetTimer("message", 30000, false);
    return 1;
}
forward message(playerid);
public message(playerid)
{
    new currentveh;
    currentveh = GetPlayerVehicleID(playerid);
    DestroyVehicle(currentveh);
    new name[MAX_PLAYER_NAME], string[124+MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "Se ha destruído el vehículo de %s despues de 30 segundos de espera.", name);
    print(string);
}

I want that if the player gets out of the car then destroy the car, but if the player gets back to the car then keep it.
__________________
Pura Joda; Co-Owner.

Super_Panda is offline   Reply With Quote
Old 27/12/2011, 12:37 AM   #2
coole210
High-roller
 
Join Date: Jul 2008
Location: Canada
Posts: 1,033
Reputation: 84
Default Re: OnPlayerEnter&ExitVehcile

Code:
//TOP:
new msgtimer[MAX_PLAYERS];
//
public OnPlayerExitVehicle(playerid, vehicleid)
{
    SendClientMessage(playerid,-1,"You have 30 seconds to get back in the car !");
    msgtimer[playerid] = SetTimerEx("message",30000,false,"dd",playerid,vehicleid);
    return 1;
}
forward message(playerid,vehicleid);
public message(playerid,vehicleid)
{
    if(GetPlayerVehicleID(playerid) != vehicleid)
    {
        DestroyVehicle(vehicleid);
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        print("Se ha destruído el vehículo de %s despues de 30 segundos de espera.",name);
    }
    else
    {
        KillTimer(msgtimer[playerid]);
    }
    return 1;
}
code fixed
coole210 is offline   Reply With Quote
Old 27/12/2011, 01:23 AM   #3
Jovanny
Banned
 
Join Date: Oct 2010
Location: Siиαloα
Posts: 1,482
Reputation: 0
Default Respuesta: OnPlayerEnter&ExitVehcile

pawn Code:
//TOP:
new msgtimer[MAX_PLAYERS];
//
public OnPlayerExitVehicle(playerid, vehicleid)
{
    SendClientMessage(playerid,-1,"You have 30 seconds to get back in the car !");
    msgtimer[playerid] = SetTimerEx("message",30000,false,"dd",playerid,vehicleid);
    return 1;
}
forward message(playerid,vehicleid);
public message(playerid,vehicleid)
{
    if(GetPlayerVehicleID(playerid) != vehicleid)
    {
        DestroyVehicle(vehicleid);
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        printf("Se ha destruído el vehículo de %s despues de 30 segundos de espera.",name);
    }
    else
    {
        KillTimer(msgtimer[playerid]);
    }
    return 1;
}
is "printf" no "print"
EDIT: Super Panda, you can ask for help in Spanish section and we will help, I speak Spanish, speak little English
Jovanny is offline   Reply With Quote
Old 27/12/2011, 02:28 AM   #4
Ballu Miaa
High-roller
 
Ballu Miaa's Avatar
 
Join Date: Apr 2010
Location: New Delhi,India
Posts: 1,915
Reputation: 315
Default Re: OnPlayerEnter&ExitVehcile

I want to write in Caps but i wont!! Use CreateVehicle(ModelID,X,Y,Z,Angle,Color1,Color2,Re spawnDelayinMs);
Use this function under OnGameModeInIt as an example!

pawn Code:
CreateVehicle(522,456.134,7945.45,4855.3666,208.456,172,172,5 * 60 * 1000);
This code will add a NRG500 With Purple color on given X,Y,Z with Angle and it will respawn when a player is not driving it till 5 Minutes. If the player come's back in it auto cancel's the respawn!

No use of any other function!
__________________
I successfully reset password for my account and retrieved it after a few months.

I am back on work!



I will take half payment as an advance to script for you.
Click here to request my Scripting Service.

Ballu Miaa is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Some moar helps with OnPlayerEnter/ExitVehicle willsuckformoney Help Archive 7 09/07/2010 10:48 AM
OnPlayerEnter&ExitVehicle Rubennnnn Help Archive 22 07/02/2010 03:22 PM
OnPlayerEnter vehicle problem. bartje01 Help Archive 6 01/02/2010 04:46 PM
[HELP] OnPlayerEnter And OnPlayerleaveCheckPoint [SFSF]Ali Help Archive 1 15/03/2009 08:17 AM


All times are GMT. The time now is 12:50 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.