/detach
#1

how i can do that if player type /detach then server send message You detach your (trailer name) code is

// Code

if(strcmp(cmdtext, "/detach", true) == 0)
{
new vehid223;
vehid223 = GetPlayerVehicleID(playerid);
DetachTrailerFromVehicle(vehid223);
new newtext[256];
format(newtext, sizeof(newtext), "You detach your %s"); i want in here
TextDrawSetString(TextdrawText, newtext);
TextDrawShowForPlayer(playerid, TextdrawText);
SetTimer("TextdrawTextRemove", 2000, false);
return 1;
}
Reply
#2

Top of script is Trailers names

// Code

new aTrailersNames[212][] = {
{"Article Trailer"},
{"Article Trailer 2"},
{"Article Trailer 3"},
{"Petrol Trailer"},
{"Baggage Trailer A"},
{"Baggage Trailer B"},
{"Tug Stairs Trailer"},
{"Farm Trailer"},
{"Utility Trailer"}
};

// Code

if(strcmp(cmdtext, "/detach", true) == 0)
{
new vehid223;
vehid223 = GetPlayerVehicleID(playerid);
DetachTrailerFromVehicle(vehid223);
new newtext[256];
format(newtext, sizeof(newtext), "You detach your %s", aTrailersNames[model-400]);
TextDrawSetString(TextdrawText, newtext);
TextDrawShowForPlayer(playerid, TextdrawText);
SetTimer("TextdrawTextRemove", 2000, false);
return 1;
}
Reply
#3

Quote:
Originally Posted by Mr.Jvxmc
Посмотреть сообщение
Top of script is Trailers names

// Code

new aTrailersNames[212][] = {
{"Article Trailer"},
{"Article Trailer 2"},
{"Article Trailer 3"},
{"Petrol Trailer"},
{"Baggage Trailer A"},
{"Baggage Trailer B"},
{"Tug Stairs Trailer"},
{"Farm Trailer"},
{"Utility Trailer"}
};

// Code

if(strcmp(cmdtext, "/detach", true) == 0)
{
new vehid223;
vehid223 = GetPlayerVehicleID(playerid);
DetachTrailerFromVehicle(vehid223);
new newtext[256];
format(newtext, sizeof(newtext), "You detach your %s", aTrailersNames[model-400]);
TextDrawSetString(TextdrawText, newtext);
TextDrawShowForPlayer(playerid, TextdrawText);
SetTimer("TextdrawTextRemove", 2000, false);
return 1;
}
That won't work. You need all the vehicles names in order to do this. Also [.pawn][/.pawn] (without the .'s) your code.
Reply
#4

shouldnt it be possible if u can make a check with 8x getvehiclemodel? then the models of the 8 trailers and return their names?
Reply
#5

pawn Код:
new Trailers[10][] = {"Article Trailer","Article Trailer 2","Article Trailer 3","Baggage Trailer \"A\"","Baggage Trailer \"B\"","Farm Trailer","Petrol Trailer","Stairs Trailer","Utility Trailer","Unknown"};

stock TrailerID(v)
{
    switch(v)
    {
        case 435: return 0;
        case 450: return 1;
        case 591: return 2;
        case 606: return 3;
        case 607: return 4;
        case 610: return 5;
        case 584: return 6;
        case 608: return 7;
        case 611: return 8;
    }
    return 9;
}
if(!strcmp(cmdtext, "/detach", true))
{
    new ID,Model,Trailer;
    ID = GetPlayerVehicleID(playerid);
    if(IsTrailerAttachedToVehicle(ID))
    {
        new newtext[64];
        Trailer = GetVehicleTrailer(ID);
        Model = GetVehicleModel(Trailer);
        DetachTrailerFromVehicle(ID);
        format(newtext, sizeof(newtext), "You detach your %s",Trailers[TrailerID(Model)]);
        TextDrawSetString(TextdrawText, newtext);
        TextDrawShowForPlayer(playerid, TextdrawText);
        SetTimer("TextdrawTextRemove", 2000, false);
    }// else trailer not attached
    return 1;
}
+ GetPlayerVehicleSeat + TextdrawText[playerid] not TextdrawText + SetTimerEx not SetTimer
Reply
#6

Thx

Topic Closed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)