SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 28/01/2014, 05:15 PM   #1
MahdiGames
Banned
 
Join Date: Nov 2013
Posts: 283
Reputation: 3
Default Reps , Help , Fast please:S

I need a function that destroy vehicle like "DestroyVehicle(playerid);", I'v tried some functions like:"
Code:
    for(new i;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInVehicle(i, vehid)) return 1;
        }
    }
But its destroy vehicles which are not occupation , please help i want code thats when player death destroy his car, and when exit from server and when exit from vehicle thanks !
Code:
public OnPlayerDisconnect(playerid, reason)
{
//AnyFunction Destroy the playerid vehicle when he leave if he was on vehicle.
return 1;
}
OnPlayerExitVehicle(p...)
{
//Send timer to destroy his vehicle if he not back with 1 min
return 1;
}
OnPlayerDeath
{
//Destroy playerid vehicle
}
MahdiGames is offline   Reply With Quote
Old 28/01/2014, 05:18 PM   #2
Abagail
High-roller
 
Join Date: Dec 2013
Location: GetPlayerPos(playerid, pos); Scripter/Mapper.
Posts: 3,133
Reputation: 445
Default Re: Reps , Help , Fast please:S

Can you show a litte more code? We have no idea what this even goes along with...
Abagail is offline   Reply With Quote
Old 28/01/2014, 05:28 PM   #3
Smileys
Huge Clucker
 
Smileys's Avatar
 
Join Date: Dec 2013
Location: Home.
Posts: 384
Reputation: 31
Default Re: Reps , Help , Fast please:S

if( IsPlayerInVehicle( playerid, playercar ) );

DestroyVehicle( playercar );
Smileys is offline   Reply With Quote
Old 28/01/2014, 05:33 PM   #4
MahdiGames
Banned
 
Join Date: Nov 2013
Posts: 283
Reputation: 3
Default Re: Reps , Help , Fast please:S

Quote:
Originally Posted by Smileys View Post
if( IsPlayerInVehicle( playerid, playercar ) );

DestroyVehicle( playercar );
Thanks for trying to help is there are better function
MahdiGames is offline   Reply With Quote
Old 28/01/2014, 05:37 PM   #5
[WSF]ThA_Devil
Gangsta
 
[WSF]ThA_Devil's Avatar
 
Join Date: Sep 2010
Location: United Kingdom
Posts: 662
Reputation: 55
Default Re: Reps , Help , Fast please:S

Quote:
Originally Posted by MahdiGames View Post
Thanks for trying to help is there are better function
You have to work with functions that you're given....

try:
pawn Code:
if(IsPlayerInAnyVehicle(playerid){
DestroyVehicle(GetPlayerVehicleID(playerid));
}
[WSF]ThA_Devil is offline   Reply With Quote
Old 28/01/2014, 05:52 PM   #6
MahdiGames
Banned
 
Join Date: Nov 2013
Posts: 283
Reputation: 3
Default Re: Reps , Help , Fast please:S

Quote:
Originally Posted by [WSF]ThA_Devil View Post
You have to work with functions that you're given....

try:
pawn Code:
if(IsPlayerInAnyVehicle(playerid){
DestroyVehicle(GetPlayerVehicleID(playerid));
}
Not worked :S
MahdiGames is offline   Reply With Quote
Old 28/01/2014, 05:55 PM   #7
[WSF]ThA_Devil
Gangsta
 
[WSF]ThA_Devil's Avatar
 
Join Date: Sep 2010
Location: United Kingdom
Posts: 662
Reputation: 55
Default Re: Reps , Help , Fast please:S

Quote:
Originally Posted by MahdiGames View Post
Not worked :S
Did it compile without errors? Since I typed it from my head....
[WSF]ThA_Devil is offline   Reply With Quote
Old 28/01/2014, 05:57 PM   #8
MahdiGames
Banned
 
Join Date: Nov 2013
Posts: 283
Reputation: 3
Default Re: Reps , Help , Fast please:S

Quote:
Originally Posted by [WSF]ThA_Devil View Post
Did it compile without errors? Since I typed it from my head....
Yes, in the fact i fixed onplayerdeath on player disconnect i need one for onplayerexit vehicle
MahdiGames is offline   Reply With Quote
Old 28/01/2014, 05:59 PM   #9
Abagail
High-roller
 
Join Date: Dec 2013
Location: GetPlayerPos(playerid, pos); Scripter/Mapper.
Posts: 3,133
Reputation: 445
Default Re: Reps , Help , Fast please:S

Code:
public OnPlayerDisconnect(playerid, reason)
{
if(!IsPlayerInAnyVehicle) return 0;
DestroyVehicle(GetPlayerVehicleID(playerid));
return 1;
}
OnPlayerExitVehicle(p...)
{
SetTimerEx("DestroyVehicle", 10000, false, "i", playerid);
SetPVarInt(playerid, "DestroyVehicle", vehicleid)
}
return 1;
}
OnPlayerDeath
{
if(!IsPlayerInAnyVehicle) return 0;
DestroyVehicle(GetPlayerVehicleID(playerid));
}

public DestroyVehicle(playerid)
{
new vehicleid == GetPVarInt(playerid, "DestroyVehicle");
DestroyVehicle(vehicleid);
}
Untested.
Abagail is offline   Reply With Quote
Old 28/01/2014, 06:04 PM   #10
MahdiGames
Banned
 
Join Date: Nov 2013
Posts: 283
Reputation: 3
Default Re: Reps , Help , Fast please:S

Quote:
Originally Posted by Abagail View Post
Code:
public OnPlayerDisconnect(playerid, reason)
{
if(!IsPlayerInAnyVehicle) return 0;
DestroyVehicle(GetPlayerVehicleID(playerid));
return 1;
}
OnPlayerExitVehicle(p...)
{
SetTimerEx("DestroyVehicle", 10000, false, "i", playerid);
SetPVarInt(playerid, "DestroyVehicle", vehicleid)
}
return 1;
}
OnPlayerDeath
{
if(!IsPlayerInAnyVehicle) return 0;
DestroyVehicle(GetPlayerVehicleID(playerid));
}

public DestroyVehicle(playerid)
{
new vehicleid == GetPVarInt(playerid, "DestroyVehicle");
DestroyVehicle(vehicleid);
}
Untested.
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(150) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(167) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(183) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(213) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(260) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(6709) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(9456) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(9470) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(9485) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(9499) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(9746) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(9947) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(9954) : error 021: symbol already defined: "DestroyVehicle"
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(9956) : error 001: expected token: ";", but found "=="
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(9961) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(10279) : warning 203: symbol is never used: "vehicleid"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
MahdiGames 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
Help Please , REPS+ MahdiGames Scripting Help 4 26/01/2014 12:53 PM
HELP PLEASE!! REPS MahdiGames Scripting Help 3 24/01/2014 02:12 PM
Help with the reps Jigsaw123 General 1 22/01/2014 05:37 PM
How else can i get reps samp-gaming Everything and Nothing 10 28/09/2012 05:44 AM


All times are GMT. The time now is 05:00 PM.


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