CMD: /checksb
#1

I want to make this cmd: /checksb for people to check to see if they wearing a seat belt and Can you make the cmd for me? I got /seatbelt cmd in already but i don't know how to /checksb for players
Please help me?

Код:
YCMD:seatbelt(playerid, params[], help)
{
	if(help) {
		SendClientMessage(playerid, X11_WHITE, "Toggles the vehicle seatbelt");
		return 1;
	}
	if(!IsPlayerInAnyVehicle(playerid) || !HasSeatbelts(GetVehicleModel(GetPlayerVehicleID(playerid))))
	{ //line 124
		SendClientMessage(playerid, COLOR_LIGHTRED, "	You need to be in a car!");
		return 1;
	}
    new string[53];
    if(!Seatbelt[playerid])
	{
	    Seatbelt[playerid] = true;
	    format(string, sizeof(string), "* %s buckles %s seatbelt up.", GetPlayerNameEx(playerid,ENameType_RPName), getPossiveAdjective(playerid));
	}
	else
	{
		Seatbelt[playerid] = false;
		format(string, sizeof(string), "* %s unbuckles %s seatbelt.", GetPlayerNameEx(playerid,ENameType_RPName), getPossiveAdjective(playerid));
	}
	ProxMessage(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
	return 1;
}
Reply
#2

pawn Код:
YCMD:checksb(playerid, params[], help)
{
    if(help) {
        SendClientMessage(playerid, X11_WHITE, "Check if you are wearing the seat belt or not");
        return 1;
    }
    if(!IsPlayerInAnyVehicle(playerid) || !HasSeatbelts(GetVehicleModel(GetPlayerVehicleID(playerid))))
    { //line 124
        SendClientMessage(playerid, COLOR_LIGHTRED, "You need to be in a car!");
        return 1;
    }
if(!Seatbelt[playerid])
    {
        SendClientMessage(playerid,-1,"You aren't wearing a seat belt");
    }
    else
    {
        SendClentMessage(playerid,-1,"You are wearing a seat belt");
    }
        return 1;
}
Reply
#3

PHP код:
CMD:cb(playeridparams[]) return cmd_checkbelt(playeridparams);
CMD:checkbelt(playeridparams[])
{
    new 
giveplayerid;
    if(
sscanf(params"u"giveplayerid)) return SendClientMessageEx(playeridCOLOR_WHITE"USAGE: /checkbelt [playerid]");
    if(
GetPlayerState(giveplayerid) == PLAYER_STATE_ONFOOT)
    {
        
SendClientMessageEx(playerid,COLOR_GREY,"That player is not in any vehicle!");
        return 
1;
    }
    if (
ProxDetectorS(9.0playeridgiveplayerid))
    {
        new 
string[128];
        new 
stext[4];
        if(
Seatbelt[giveplayerid] == 0) { stext "off"; }
        else { 
stext "on"; }
        if(
IsABike(GetPlayerVehicleID(playerid)))
        {
            
format(stringsizeof(string), "%s's helmet is currently %s." GetPlayerNameEx(giveplayerid) , stext);
            
SendClientMessageEx(playerid,COLOR_WHITE,string);
            
format(stringsizeof(string), "* %s looks at %s, checking to see if they are wearing a helmet."GetPlayerNameEx(playerid),GetPlayerNameEx(giveplayerid));
            
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        else
        {
            
format(stringsizeof(string), "%s's seat belt is currently %s." GetPlayerNameEx(giveplayerid) , stext);
            
SendClientMessageEx(playerid,COLOR_WHITE,string);
            
format(stringsizeof(string), "* %s peers through the window at %s, checking to see if they are wearing a seatbelt."GetPlayerNameEx(playerid),GetPlayerNameEx(giveplayerid));
            
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
    }
    else { 
SendClientMessageEx(playeridCOLOR_GREY"You are not around that player!"); }
    return 
1;

+rep if helped
Reply
#4

Код:
ecrp\seatbelt.pwn(312) : error 017: undefined symbol "SendClentMessage"
ecrp\seatbelt.pwn(314) : warning 217: loose indentation
Код:
YCMD:checksb(playerid, params[], help)
{
    if(help) {
        SendClientMessage(playerid, X11_WHITE, "Check if you are wearing the seat belt or not");
        return 1;
    }
    if(!IsPlayerInAnyVehicle(playerid) || !HasSeatbelts(GetVehicleModel(GetPlayerVehicleID(playerid))))
    { //line 124
        SendClientMessage(playerid, COLOR_LIGHTRED, "You need to be in a car!");
        return 1;
    }
	if(!Seatbelt[playerid])
    {
        SendClientMessage(playerid,-1,"You aren't wearing a seat belt");
    }
    else
    {
        SendClentMessage(playerid,-1,"You are wearing a seat belt");
    }
        return 1;
}
Reply
#5

Quote:
Originally Posted by pln103
Посмотреть сообщение
Код:
ecrp\seatbelt.pwn(306) : warning 217: loose indentation
ecrp\seatbelt.pwn(312) : error 017: undefined symbol "SendClentMessage"
ecrp\seatbelt.pwn(314) : warning 217: loose indentation
Код:
YCMD:checksb(playerid, params[], help)
{
    if(help) {
        SendClientMessage(playerid, X11_WHITE, "Check if you are wearing the seat belt or not");
        return 1;
    }
    if(!IsPlayerInAnyVehicle(playerid) || !HasSeatbelts(GetVehicleModel(GetPlayerVehicleID(playerid))))
    { //line 124
        SendClientMessage(playerid, COLOR_LIGHTRED, "You need to be in a car!");
        return 1;
    }
if(!Seatbelt[playerid])
    {
        SendClientMessage(playerid,-1,"You aren't wearing a seat belt");
    }
    else
    {
        SendClentMessage(playerid,-1,"You are wearing a seat belt");
    }
        return 1;
}
pawn Код:
YCMD:checksb(playerid, params[], help)
{
    if(help) {
        SendClientMessage(playerid, X11_WHITE, "Check if you are wearing the seat belt or not");
        return 1;
    }
    if(!IsPlayerInAnyVehicle(playerid) || !HasSeatbelts(GetVehicleModel(GetPlayerVehicleID(playerid))))
    { //line 124
        SendClientMessage(playerid, COLOR_LIGHTRED, "You need to be in a car!");
        return 1;
    }
    if(!Seatbelt[playerid])
    {
        SendClientMessage(playerid,-1,"You aren't wearing a seat belt");
    }
    else
    {
    SendClientMessage(playerid,-1,"You are wearing a seat belt");
    }
    return 1;
}
Reply
#6

....
Reply
#7

and another to check player if he wearing a seatbelt like
/checkseatbelt [ID]

And, to show message for players around him if he using a seatbelt like
/showseatbelt
Reply
#8

pawn Код:
YCMD:checkseatbelt(playerid, params[], help)
{
    new id;
    if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_RED,"/checkseatbelt [playerid]");
    if(help) {
        SendClientMessage(playerid, X11_WHITE, "Check if a player is wearing the seat belt or not");
        return 1;
    }
    if(!IsPlayerInAnyVehicle(id) || !HasSeatbelts(GetVehicleModel(GetPlayerVehicleID(id))))
    { //line 124
        SendClientMessage(playerid, COLOR_LIGHTRED, "This player need to be in a car!");
        return 1;
    }
        if(!Seatbelt[id])
    {
        SendClientMessage(playerid,-1,"This player isn't wearing a seat belt");
    }
    else
    {
    SendClientMessage(playerid,-1,"this player is wearing a seat belt");
    }
    return 1;
}
and can you explain the other command please?
Reply
#9

Well the other one is just for himself and showing to the players around him like
/showseatbelt
He wanted to show players for if him wearing a seatbelt

Then other cmd you posted for other players to check on him if he wearing a seatbelt.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)