Cuff System Warning ! help fast please
#1

Hello i can't fix that warning/error i tried many times but i'm always fail
So i'm here to post my codes and give me a good way to fix that
Here is the codes :

Код:
C:\Users\infogenie\Desktop\Zombies VS Humans V1.1\filterscripts\Handcuffs.pwn(61) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Код:
COMMAND:uncuff(playerid, params[])
{
    new id,Cuff[MAX_PLAYERS],Name[MAX_PLAYER_NAME],string[MAX_PLAYERS],pskin = GetPlayerSkin(playerid);
    for (new i=0; i<MAX_PLAYERS; i++){
		if(pskin == 2 || pskin == 3 || pskin == 4 || pskin == 5 || pskin == 6 || pskin == 7 || pskin == 9 || pskin == 11 || pskin == 12 || pskin == 15 || pskin == 16 || pskin == 19 || pskin == 21 || pskin == 23 || pskin == 29 || pskin == 33 || pskin == 34 || pskin == 41 || pskin == 280 || pskin == 281 || pskin == 282 || pskin == 283 || pskin == 284 || pskin == 285 || pskin == 286 || pskin == 287){
	if(sscanf(params,"u", id))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /uncuff [id]");
	if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found.");
	if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xC0C0C0FF,"**You can't uncuff someone from a vehicle.");
 	if(id == playerid)return SendClientMessage(playerid,0xC0C0C0FF,"**You cannot uncuff yourself.");
 	if(GetDistanceBetweenPlayers(playerid,id)> 2)return SendClientMessage(playerid,0xC0C0C0FF,"You are too far from that player");
    else return SendClientMessage(playerid,0xC0C0C0FF,"You dont have permisson to access this command.");
	}
    {
	TogglePlayerControllable(id,true);
    }
	{
	GetPlayerName(playerid, Name, sizeof(Name));
	format(string, sizeof(string), "Your handcuffs have been removed by %s.",Name);
	}
	SendClientMessage(i,0xFF0000FF,string);
	}
    Cuff[id] = 0;
	return 1;
}
Reply
#2

Whre is line 61 in the code ?
Reply
#3

ok look.
it's this lol
under else return
Код:
{
Reply
#4

There are a lot of issues with the command itself:

- Declaring "Cuff" array in the command will not be accessible by other places and won't store anything at all.
- The player loop has no meaning.
- Getting the skin of the player who typed the command is probably not what you wanted to do but the skin of "id" instead (which should be done after sscanf).
- Checking if the player who typed the command is again the other way around, check if "id" is in any vehicle.
- Not returning a value to stop the code if player is not connected.
- The else statement will always get executed and the code will stop there if everything is alright (correct id, not in vehicle etc.) and will never execute the code to freeze and actually cuff the player.

---

What I may suggest is: https://sampforum.blast.hk/showthread.php?tid=349759

and it would be pretty simple:
PHP код:
COMMAND:uncuff(playeridparams[])
{
    
// Modify "..EXPRESSION_HERER.." with what you need. In example, player not being a cop.
    
if (..EXPRESSION_HERE..) return SendClientMessage(playerid0xC0C0C0FF"You dont have permisson to access this command.");
    new 
id;
    if (
sscanf(params"u"id)) return SendClientMessage(playerid0xFF0000AA"Usage: /uncuff [id]");
    if (
id == INVALID_PLAYER_ID) return SendClientMessage(playerid0xFF0000AA"Player not found.");
    if (!
IsPlayerCuffed(id)) return SendClientMessage(playerid0xC0C0C0FF"**You can't uncuff someone who is not cuffed.");
    if (
IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid0xC0C0C0FF"**You can't uncuff someone from a vehicle.");
    if (
id == playerid) return SendClientMessage(playerid0xC0C0C0FF"**You cannot uncuff yourself.");
    if (
GetDistanceBetweenPlayers(playeridid) > 2) return SendClientMessage(playerid0xC0C0C0FF"You are too far from that player");
    switch (
GetPlayerSkin(id))
    {
        case 
2..791112151619212329333441280..287:
        {
            
SetPlayerCuffed(playeridtrue);
            
// rest of code..
        
}
        
// default: return SendClientMessage(playerid, 0xC0C0C0FF, "..."); 
        // Uncomment and modify the above if you want to, for players with skin id not listed above
    
}
    return 
1;

Reply
#5

ok look i have 4 errors in line 50
Код:
C:\Users\infogenie\Desktop\Zombies VS Humans V1.1\filterscripts\Handcuffs.pwn(50) : error 029: invalid expression, assumed zero
C:\Users\infogenie\Desktop\Zombies VS Humans V1.1\filterscripts\Handcuffs.pwn(50) : error 017: undefined symbol "EXPRESSION_HERE"
C:\Users\infogenie\Desktop\Zombies VS Humans V1.1\filterscripts\Handcuffs.pwn(50) : error 029: invalid expression, assumed zero
C:\Users\infogenie\Desktop\Zombies VS Humans V1.1\filterscripts\Handcuffs.pwn(50) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Код:
	if (..EXPRESSION_HERE..) return SendClientMessage(playerid, 0xC0C0C0FF, "You dont have permisson to access this command.")
Reply
#6

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
[..]
- The else statement will always get executed and the code will stop there if everything is alright (correct id, not in vehicle etc.) and will never execute the code to freeze and actually cuff the player.

[..]

PHP код:
// Modify "..EXPRESSION_HERER.." with what you need. In example, player not being a cop.
if (..EXPRESSION_HERE..) return SendClientMessage(playerid0xC0C0C0FF"You dont have permisson to access this command."); 
I wrote in the command that you have modify it and add an expression like the player is not a police officer or whatever. That was your code so you had it there for a reason. If you don't want it then remove it but I'm pretty sure you don't want random players to use the command.
Reply
#7

Listen i scripted Zombie Gamemode. and i have features in this server
The humans can cuff the zombies and the Zombies can throw knives and diging and they have some powers too.
ok i"m newbie scripter and i have a simple GM but
how to modify it?
you mean if (..PLAYER..) instead of EXPRESSION_HERE?
remember i'm newbie i'm so sorry if you're annoyed
Reply
#8

You need to replace it with the variable you have to identify if a player is "Human" and if the player is not, then return the error. I don't know what your code looks like but an example:
pawn Код:
if (gPlayer_Team[playerid] != TEAM_HUMAN) return SendClientMessage(playerid, 0xC0C0C0FF, "You dont have permisson to access this command.");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)