SA-MP Forums Archive
Hey, My /detain doesent work. Help me please! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Hey, My /detain doesent work. Help me please! (/showthread.php?tid=450298)



Hey, My /detain doesent work. Help me please! - EkaFist - 12.07.2013

Hey guys. as the title says. my /detain in my RP doesn't work. here's my code:

Код:
CMD:detain(playerid, params[])
{
	new playerb, seatid, string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(!IsACop(playerid) && !IsFBI(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an LSPD Oficer/FBI Agent.");
	if(sscanf(params, "ui", playerb, seatid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /detain [playerid] [seatid]");
	if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
	if(!IsPlayerNearPlayer(playerid, playerb, 2)) return SendClientMessage(playerid, COLOR_GREY, "You can't detain someone from this disatance.");
	if(!IsPlayerCuffed(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Player is not cuffed.");
	if(!IsCruiser(LastCar[playerid])) return SendClientMessage(playerid, COLOR_GREY, "You need an LSPD crusier to detain someone in.");
	if(seatid < 2 || seatid > 3) return SendClientMessage(playerid, COLOR_GREY, "You can only detain people in seats 2 and 3.");
	PutPlayerInVehicle(playerb, LastCar[playerid], seatid);
	format(string, sizeof(string), "* %s grabs %s from their cuffs and throws him inside the LSPD cruiser.", RPN(playerid), RPN(playerb));
	SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	return 1;
}
If you will fix this. I'm gonna be so happy. thank you in advance.


Re: Hey, My /detain doesent work. Help me please! - xganyx - 12.07.2013

pawn Код:
CMD:detain(playerid, params[])
{
    new playerb, seatid, string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsACop(playerid) && !IsFBI(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an LSPD Oficer/FBI Agent.");
    if(sscanf(params, "ui", playerb, seatid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /detain [playerid] [seatid]");
    if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
    if(!IsPlayerNearPlayer(playerid, playerb, 2)) return SendClientMessage(playerid, COLOR_GREY, "You can't detain someone from this disatance.");
    if(!IsPlayerCuffed(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Player is not cuffed.");
    if(!IsCruiser(LastCar[playerid])) return SendClientMessage(playerid, COLOR_GREY, "You need an LSPD crusier to detain someone in.");
    if(seatid < 2 || seatid > 3) return SendClientMessage(playerid, COLOR_GREY, "You can only detain people in seats 2 and 3.");
    PutPlayerInVehicle(playerb//what is this ?????, LastCar[playerid], seatid);
    format(string, sizeof(string), "* %s grabs %s from their cuffs and throws him inside the LSPD cruiser.", RPN(playerid), RPN(playerb));
    SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
    return 1;
}



Re: Hey, My /detain doesent work. Help me please! - EkaFist - 12.07.2013

Quote:
Originally Posted by xganyx
Посмотреть сообщение
pawn Код:
CMD:detain(playerid, params[])
{
    new playerb, seatid, string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsACop(playerid) && !IsFBI(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an LSPD Oficer/FBI Agent.");
    if(sscanf(params, "ui", playerb, seatid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /detain [playerid] [seatid]");
    if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
    if(!IsPlayerNearPlayer(playerid, playerb, 2)) return SendClientMessage(playerid, COLOR_GREY, "You can't detain someone from this disatance.");
    if(!IsPlayerCuffed(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Player is not cuffed.");
    if(!IsCruiser(LastCar[playerid])) return SendClientMessage(playerid, COLOR_GREY, "You need an LSPD crusier to detain someone in.");
    if(seatid < 2 || seatid > 3) return SendClientMessage(playerid, COLOR_GREY, "You can only detain people in seats 2 and 3.");
    PutPlayerInVehicle(playerb//what is this ?????, LastCar[playerid], seatid);
    format(string, sizeof(string), "* %s grabs %s from their cuffs and throws him inside the LSPD cruiser.", RPN(playerid), RPN(playerb));
    SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
    return 1;
}
Im not the one who coded this so i don't really know much. but is that an error? can you fix it?


Re: Hey, My /detain doesent work. Help me please! - EkaFist - 12.07.2013

Bump


Re: Hey, My /detain doesent work. Help me please! - dominik523 - 12.07.2013

I got the same script, and I don't will this work, but try this:
Код:
CMD:detain(playerid, params[])
{
	new playerb, seatid, string[128], vehicle;
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(!IsACop(playerid) && !IsFBI(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an SFPD Oficer/FBI Agent.");
	if(sscanf(params, "ui", playerb, seatid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /detain [playerid] [seatid]");
	if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
	if(!IsPlayerNearPlayer(playerid, playerb, 2)) return SendClientMessage(playerid, COLOR_GREY, "You can't detain someone from this disatance.");
	if(!IsPlayerCuffed(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Player is not cuffed.");
	vehicle = GetPlayerVehicleID(playerid);
	if(!IsCruiser(vehicle)) return SendClientMessage(playerid, COLOR_GREY, "You need an SFPD crusier to detain someone in.");
	if(seatid < 2 || seatid > 3) return SendClientMessage(playerid, COLOR_GREY, "You can only detain people in seats 2 and 3.");
	PutPlayerInVehicle(playerb, vehicle, seatid);
	format(string, sizeof(string), "* %s grabs %s from their cuffs and throws him inside the SFPD cruiser.", RPN(playerid), RPN(playerb));
	SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	return 1;
}
that lastcar is just a variable declared on the top of the script, and I think it does nothing in this command


Re: Hey, My /detain doesent work. Help me please! - EkaFist - 13.07.2013

Quote:
Originally Posted by dominik523
Посмотреть сообщение
I got the same script, and I don't will this work, but try this:
Код:
CMD:detain(playerid, params[])
{
	new playerb, seatid, string[128], vehicle;
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(!IsACop(playerid) && !IsFBI(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an SFPD Oficer/FBI Agent.");
	if(sscanf(params, "ui", playerb, seatid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /detain [playerid] [seatid]");
	if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
	if(!IsPlayerNearPlayer(playerid, playerb, 2)) return SendClientMessage(playerid, COLOR_GREY, "You can't detain someone from this disatance.");
	if(!IsPlayerCuffed(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Player is not cuffed.");
	vehicle = GetPlayerVehicleID(playerid);
	if(!IsCruiser(vehicle)) return SendClientMessage(playerid, COLOR_GREY, "You need an SFPD crusier to detain someone in.");
	if(seatid < 2 || seatid > 3) return SendClientMessage(playerid, COLOR_GREY, "You can only detain people in seats 2 and 3.");
	PutPlayerInVehicle(playerb, vehicle, seatid);
	format(string, sizeof(string), "* %s grabs %s from their cuffs and throws him inside the SFPD cruiser.", RPN(playerid), RPN(playerb));
	SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	return 1;
}
that lastcar is just a variable declared on the top of the script, and I think it does nothing in this command
it still dont work. it still says the error "%s grabs %s from their cuffs and throws him inside the SFPD cruiser"