Need help with command [+rep for helpers]
#1

When someone dies, I have to put him in the ambulance with the command /Stretcher, but the system send me this message.

picture of example:



the code of the CMD:

PHP код:
    if(strcmp(cmd"/stretcher"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pMember] == 4)
            {
                if(
IsPlayerInAnyVehicle(playerid))
                {
                    
SendClientMessage(playeridCOLOR_GREY"   Cannot use this while being in the Car !");
                    return 
1;
                }
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                return 
SendClientMessage(playeridCOLOR_WHITE"USAGE: /stretcher [playerid/PartOfName] [seatid]");
                
giveplayerid ReturnUser(tmp);
                  
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                return 
SendClientMessage(playeridCOLOR_WHITE"USAGE: /stretcher [playerid/PartOfName] [seatid]");
                new 
seat strvalEx(tmp);
                if(
IsPlayerConnected(giveplayerid))
                {
                    if(
giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(
seat || seat 3)
                        {
                            
SendClientMessage(playeridCOLOR_GREY"   Seat cannot be below 1 or above 3 !");
                            return 
1;
                        }
                        if(
IsPlayerInAnyVehicle(giveplayerid))
                        {
                            
SendClientMessage(playeridCOLOR_GREY"   That player is in a Car, get him out first !");
                            return 
1;
                        }
                        if(
ProxDetectorS(8.0playeridgiveplayerid))
                        {
                            if(
giveplayerid == playerid) { SendClientMessage(playeridCOLOR_GREY"   You cannot put yourself in a stretcher !"); return 1; }
                            if(
PlayerHurt[giveplayerid])
                            {
                                new 
carid gLastCar[playerid];
                                if(
IsInvalidDetainVehicle(carid)) { SendClientMessage(playeridCOLOR_GREY"   You can't put someone in that vehicle !"); return 1; }
                                   
//foreach(Player, i)
                                
for(new ii<MAX_PLAYERSi++)
                                {
                                    if(
IsPlayerInAnyVehicle(i))
                                    {
                                        if(
GetPlayerVehicleID(i) == gLastCar[playerid])
                                        {
                                              if(
GetPlayerVehicleSeat(i) == seat)
                                            {
                                                
format(stringsizeof(string), "   That seat is occupied by %s !"PlayerName(i));
                                                
SendClientMessage(playeridCOLOR_GREYstring);
                                                return 
1;
                                            }
                                        }
                                    }
                                }
                                
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
                                
GetPlayerName(playeridsendernamesizeof(sendername));
                                
format(stringsizeof(string), "* You were put into a stretcher by %s."sendername);
                                
SendClientMessage(giveplayeridCOLOR_LIGHTBLUEstring);
                                if(
PlayerInfo[giveplayerid][pMask] == 1)
                                {
                                    
format(stringsizeof(string), "* You have put A Stranger into a stretcher.");
                                    
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                                    
format(stringsizeof(string), "* %s puts A Stranger into a stretcher and puts him in the vehicle."PlayerName(playerid));
                                    
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                                }
                                else
                                {
                                    
format(stringsizeof(string), "* You put %s into a stretcher."PlayerName(giveplayerid));
                                    
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                                    
format(stringsizeof(string), "* %s puts %s into a stretcher and puts him in the vehicle."sendernamePlayerName(giveplayerid));
                                    
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                                }
                                
ClearAnimations(giveplayerid);
                                if(
IsInvalidDetainSeat(carid))
                                {
                                    
PutPlayerInVehicle(giveplayerid,carid,1);
                                }
                                else
                                {
                                    
PutPlayerInVehicle(giveplayerid,carid,seat);
                                }
                            }
                            else
                            {
                                
SendClientMessage(playeridCOLOR_GREY"   That player needs to be restrained first !");
                                return 
1;
                            }
                        }
                        else
                        {
                            
SendClientMessage(playeridCOLOR_GREY"   That player is not near you !");
                            return 
1;
                        }
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GREY"   That player is Offline !");
                    return 
1;
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GREY"   You are not a Paramedic / Fireman !");
            }
        }
        return 
1;
    } 
Код:
I want you change all the code only for it to put the man into the car.
+rep for helpers and thanks
Reply
#2

It's misleading message I guess. It happens when
pawn Код:
!PlayerHurt[giveplayerid]
Look around your code for PlayerHurt.
Reply
#3

You can change the code to do only the action put the person into a car?
Reply
#4

?
Reply
#5

Please I need quick help ! thanks for helpers i give +rep !
Reply
#6

Check your code for PlayerHurt assigning into 1, or post your onplayerdeath
Reply
#7

This might do it:
Код:
 if(strcmp(cmd, "/stretcher", true) == 0) 
    { 
        if(IsPlayerConnected(playerid)) 
        { 
            if(PlayerInfo[playerid][pMember] == 4) 
            { 
                if(IsPlayerInAnyVehicle(playerid)) 
                { 
                    SendClientMessage(playerid, COLOR_GREY, "   Cannot use this while being in the Car !"); 
                    return 1; 
                } 
                tmp = strtok(cmdtext, idx); 
                if(!strlen(tmp)) 
                return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /stretcher [playerid/PartOfName] [seatid]"); 
                giveplayerid = ReturnUser(tmp); 
                  tmp = strtok(cmdtext, idx); 
                if(!strlen(tmp)) 
                return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /stretcher [playerid/PartOfName] [seatid]"); 
                new seat = strvalEx(tmp); 
                if(IsPlayerConnected(giveplayerid)) 
                { 
                    if(giveplayerid != INVALID_PLAYER_ID) 
                    { 
                        if(seat < 1 || seat > 3) 
                        { 
                            SendClientMessage(playerid, COLOR_GREY, "   Seat cannot be below 1 or above 3 !"); 
                            return 1; 
                        } 
                        if(IsPlayerInAnyVehicle(giveplayerid)) 
                        { 
                            SendClientMessage(playerid, COLOR_GREY, "   That player is in a Car, get him out first !"); 
                            return 1; 
                        } 
                        if(ProxDetectorS(8.0, playerid, giveplayerid)) 
                        { 
                            if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "   You cannot put yourself in a stretcher !"); return 1; } 
                            if(PlayerHurt[giveplayerid]) 
                            { 
                                new carid = gLastCar[playerid]; 
                                if(IsInvalidDetainVehicle(carid)) { SendClientMessage(playerid, COLOR_GREY, "   You can't put someone in that vehicle !"); return 1; } 
                                   //foreach(Player, i) 
                                for(new i; i<MAX_PLAYERS; i++) 
                                { 
                                    if(IsPlayerInAnyVehicle(i)) 
                                    { 
                                        if(GetPlayerVehicleID(i) == gLastCar[playerid]) 
                                        { 
                                              if(GetPlayerVehicleSeat(i) == seat) 
                                            { 
                                                format(string, sizeof(string), "   That seat is occupied by %s !", PlayerName(i)); 
                                                SendClientMessage(playerid, COLOR_GREY, string); 
                                                return 1; 
                                            } 
                                        } 
                                    } 
                                } 
                                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); 
                                GetPlayerName(playerid, sendername, sizeof(sendername)); 
                                format(string, sizeof(string), "* You were put into a stretcher by %s.", sendername); 
                                SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string); 
                                if(PlayerInfo[giveplayerid][pMask] == 1) 
                                { 
                                    format(string, sizeof(string), "* You have put A Stranger into a stretcher."); 
                                    SendClientMessage(playerid, COLOR_LIGHTBLUE, string); 
                                    format(string, sizeof(string), "* %s puts A Stranger into a stretcher and puts him in the vehicle.", PlayerName(playerid)); 
                                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); 
                                } 
                                else 
                                { 
                                    format(string, sizeof(string), "* You put %s into a stretcher.", PlayerName(giveplayerid)); 
                                    SendClientMessage(playerid, COLOR_LIGHTBLUE, string); 
                                    format(string, sizeof(string), "* %s puts %s into a stretcher and puts him in the vehicle.", sendername, PlayerName(giveplayerid)); 
                                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); 
                                } 
                                ClearAnimations(giveplayerid); 
                                if(IsInvalidDetainSeat(carid)) 
                                { 
                                    PutPlayerInVehicle(giveplayerid,carid,1); 
                                } 
                                else 
                                { 
                                    PutPlayerInVehicle(giveplayerid,carid,seat); 
                                } 
                            } 
                            else 
                            { 
                                SendClientMessage(playerid, COLOR_GREY, "   That player needs to be restrained first !"); 
                                return 1; 
                    } 
                } 
                else 
                { 
                    SendClientMessage(playerid, COLOR_GREY, "   That player is Offline !"); 
                    return 1; 
                } 
            } 
            else 
            { 
                SendClientMessage(playerid, COLOR_GREY, "   You are not a Paramedic / Fireman !"); 
            } 
        } 
        return 1; 
    }
Reply
#8



what now ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)