Commands? -
Luis- - 04.09.2010
pawn Код:
public OnPlayerCommandText
(playerid, cmdtext
[]){ if (strcmp("/kill", cmdtext, true,
10) == 0) { SetPlayerHealth
(playerid,
0);
GameTextForPlayer
(playerid,
"~r~Wasted~r~",
5000,
3);
return 1;
} if (strcmp("/enter", cmdtext, true,
10) == 0) { if (IsPlayerInRangeOfPoint
(playerid,
5.0,
2244.7190,
-1664.5341,
15.4766)) { SetPlayerPos
(playerid,
207.737991,
-109.019996,
1005.132812);
SetPlayerInterior
(playerid,
15);
} else if(IsPlayerInRangeOfPoint
(playerid,
5.0,
1554.7692,
-1676.1294,
16.1953)) { SetPlayerPos
(playerid,
288.745971,
169.350997,
1007.171875);
SetPlayerInterior
(playerid,
3);
} else if(IsPlayerInRangeOfPoint
(playerid,
5.0,
1481.0189,
-1770.3466,
18.7958)) { SetPlayerPos
(playerid,
384.808624,
173.804992,
1008.382812);
SetPlayerInterior
(playerid,
3);
} return 1;
} if (strcmp("/exit", cmdtext, true,
10) == 0) { if (IsPlayerInRangeOfPoint
(playerid,
5.0,
207.737991,
-109.019996,
1005.132812)) { SetPlayerPos
(playerid,
2244.7190,
-1664.5341,
15.4766);
SetPlayerInterior
(playerid,
0);
} else if(IsPlayerInRangeOfPoint
(playerid,
5.0,
288.745971,
169.350997,
1007.171875)) { SetPlayerPos
(playerid,
1554.7692,
-1676.1294,
16.1953);
SetPlayerInterior
(playerid,
0);
} else if(IsPlayerInRangeOfPoint
(playerid,
5.0,
384.808624,
173.804992,
1008.382812)) { SetPlayerPos
(playerid,
1481.0189,
-1770.3466,
18.7958);
SetPlayerInterior
(playerid,
0);
} return 1;
} if (strcmp("/goto1", cmdtext, true,
10) == 0) { SetPlayerPos
(playerid,
2244.7190,
-1664.5341,
15.4766);
} if (strcmp("/goto2", cmdtext, true,
10) == 0) { SetPlayerPos
(playerid,
1481.0189,
-1770.3466,
18.7958);
} if (strcmp("/o", cmdtext, true,
10) == 0) { if(!strlen(cmdtext
)) return SendClientMessage
(playerid, COLOR_YELLOW,
"Usage: /o [chat]");
new str
[128];
GetPlayerName
(playerid, str,
sizeof(str
));
format(str,
sizeof(str
),
"(([OOC] %s: %s ))", str, cmdtext
[2]);
SendClientMessageToAll
(COLOR_GOLD, str
);
return 1;
} if (strcmp("/forums", cmdtext, true,
10) ==0) { SendClientMessage
(playerid, COLOR_YELLOW,
"Our forums are - http://lsrp.comule.com/index.php");
return 1;
} if (strcmp("/gmx", cmdtext, true,
4) == 0) { IsPlayerAdmin
(playerid
);
SendRconCommand
("gmx");
SendClientMessageToAll
(COLOR_YELLOW,
"INFO: Server restart in 1 second");
return 1;
} if (strcmp("/belt", cmdtext, true,
10) == 0) { new str
[128];
GetPlayerName
(playerid, str,
sizeof(str
));
format(str,
sizeof(str
),
"%s Has pulled his belt and attached it", str, cmdtext
);
SendClientMessage
(playerid, COLOR_YELLOW, str
);
return 1;
} if (strcmp("/window up", cmdtext, true,
10) == 0) { new str
[128];
GetPlayerName
(playerid, str,
sizeof(str
));
format(str,
sizeof(str
),
"%s Has wound his window up", str, cmdtext
);
SendClientMessage
(playerid, COLOR_YELLOW, str
);
return 1;
} if (strcmp("/window down", cmdtext, true,
15) == 0) { new str
[128];
GetPlayerName
(playerid, str,
sizeof(str
));
format(str,
sizeof(str
),
"%s Has wound his window down", str, cmdtext
);
SendClientMessage
(playerid, COLOR_YELLOW, str
);
return 1;
} if (strcmp("/window", cmdtext, true,
10) == 0) { SendClientMessage
(playerid, COLOR_YELLOW,
"Usage: /window [up/down]");
return 1;
} return 0;
}
They don't work? What is wrong?
Re: Commands? -
Sky4D - 04.09.2010
CommandText is returning 0.
pawn Код:
public OnPlayerCommandText
(playerid, cmdtext
[]){ if (strcmp("/kill", cmdtext, true,
10) == 0) { SetPlayerHealth
(playerid,
0);
GameTextForPlayer
(playerid,
"~r~Wasted~r~",
5000,
3);
return 1;
} if (strcmp("/enter", cmdtext, true,
10) == 0) { if (IsPlayerInRangeOfPoint
(playerid,
5.0,
2244.7190,
-1664.5341,
15.4766)) { SetPlayerPos
(playerid,
207.737991,
-109.019996,
1005.132812);
SetPlayerInterior
(playerid,
15);
} else if(IsPlayerInRangeOfPoint
(playerid,
5.0,
1554.7692,
-1676.1294,
16.1953)) { SetPlayerPos
(playerid,
288.745971,
169.350997,
1007.171875);
SetPlayerInterior
(playerid,
3);
} else if(IsPlayerInRangeOfPoint
(playerid,
5.0,
1481.0189,
-1770.3466,
18.7958)) { SetPlayerPos
(playerid,
384.808624,
173.804992,
1008.382812);
SetPlayerInterior
(playerid,
3);
} return 1;
} if (strcmp("/exit", cmdtext, true,
10) == 0) { if (IsPlayerInRangeOfPoint
(playerid,
5.0,
207.737991,
-109.019996,
1005.132812)) { SetPlayerPos
(playerid,
2244.7190,
-1664.5341,
15.4766);
SetPlayerInterior
(playerid,
0);
} else if(IsPlayerInRangeOfPoint
(playerid,
5.0,
288.745971,
169.350997,
1007.171875)) { SetPlayerPos
(playerid,
1554.7692,
-1676.1294,
16.1953);
SetPlayerInterior
(playerid,
0);
} else if(IsPlayerInRangeOfPoint
(playerid,
5.0,
384.808624,
173.804992,
1008.382812)) { SetPlayerPos
(playerid,
1481.0189,
-1770.3466,
18.7958);
SetPlayerInterior
(playerid,
0);
} return 1;
} if (strcmp("/goto1", cmdtext, true,
10) == 0) { SetPlayerPos
(playerid,
2244.7190,
-1664.5341,
15.4766);
} if (strcmp("/goto2", cmdtext, true,
10) == 0) { SetPlayerPos
(playerid,
1481.0189,
-1770.3466,
18.7958);
} if (strcmp("/o", cmdtext, true,
10) == 0) { if(!strlen(cmdtext
)) return SendClientMessage
(playerid, COLOR_YELLOW,
"Usage: /o [chat]");
new str
[128];
GetPlayerName
(playerid, str,
sizeof(str
));
format(str,
sizeof(str
),
"(([OOC] %s: %s ))", str, cmdtext
[2]);
SendClientMessageToAll
(COLOR_GOLD, str
);
return 1;
} if (strcmp("/forums", cmdtext, true,
10) ==0) { SendClientMessage
(playerid, COLOR_YELLOW,
"Our forums are - http://lsrp.comule.com/index.php");
return 1;
} if (strcmp("/gmx", cmdtext, true,
4) == 0) { IsPlayerAdmin
(playerid
);
SendRconCommand
("gmx");
SendClientMessageToAll
(COLOR_YELLOW,
"INFO: Server restart in 1 second");
return 1;
} if (strcmp("/belt", cmdtext, true,
10) == 0) { new str
[128];
GetPlayerName
(playerid, str,
sizeof(str
));
format(str,
sizeof(str
),
"%s Has pulled his belt and attached it", str, cmdtext
);
SendClientMessage
(playerid, COLOR_YELLOW, str
);
return 1;
} if (strcmp("/window up", cmdtext, true,
10) == 0) { new str
[128];
GetPlayerName
(playerid, str,
sizeof(str
));
format(str,
sizeof(str
),
"%s Has wound his window up", str, cmdtext
);
SendClientMessage
(playerid, COLOR_YELLOW, str
);
return 1;
} if (strcmp("/window down", cmdtext, true,
15) == 0) { new str
[128];
GetPlayerName
(playerid, str,
sizeof(str
));
format(str,
sizeof(str
),
"%s Has wound his window down", str, cmdtext
);
SendClientMessage
(playerid, COLOR_YELLOW, str
);
return 1;
} if (strcmp("/window", cmdtext, true,
10) == 0) { SendClientMessage
(playerid, COLOR_YELLOW,
"Usage: /window [up/down]");
return 1;
} return 1;
}
May work.
Re: Commands? -
Luis- - 04.09.2010
Nah dosen't work.
Re: Commands? -
Sky4D - 04.09.2010
Quote:
Originally Posted by -Luis
Nah dosen't work.
|
Alright, I don't know then, sorry. I don't use strcmp.
Re: Commands? -
Luis- - 04.09.2010
No problem.