Hey, when I try to grab roleplaying commands; /me, /do, /b, /o, /low, /w(hisper) and /pm my Pawno crashes.
When I try only ONE of them, it crashed too. What should I do?
Yes... post it
Код:
command(b, playerid, params[])
{
new Message[128], string[128];
if(sscanf(params, "z", Message))
{
SendClientMessage(playerid, WHITE, "SYNTAX: /b [message]");
}
else
{
if(strlen(Message) < 1 || !IsPlayerConnectedEx(playerid))
{
return 1;
}
else
{
if(Player[playerid][PrisonID] == 1)
{
SendClientMessage(playerid, WHITE, "You may not use this channel right now.");
}
else
{
format(string, sizeof(string), "%s says: ((%s)) ", GetName(playerid), Message);
NearByMessage(playerid, WHITE, string);
}
}
}
return 1;
}
command(me, playerid, params[]) {
new
string[128]; // Updated this as I forgot about the whole params usage at the time of originally creating this.... but seeing as how noobs constantly rip this command I might as well give them some good code to rip from! (yes I'm talking about you, RealCop228 and all the others)
if(isnull(params)) {
return SendClientMessage(playerid, WHITE, "SYNTAX: /me [action]");
}
else {
if(Player[playerid][PrisonID] == 1) {
SendClientMessage(playerid, WHITE, "You're unable to do this right now!");
}
else {
format(string, sizeof(string), "* %s %s", GetName(playerid), params);
NearByMessage(playerid, NICESKY, string);
Player[playerid][MeActions]++;
switch(Player[playerid][MeActions]) {
case 100: {
SendClientMessage(playerid, WHITE, "You have unlocked a new achievement!");
SendClientMessage(playerid, GREY, "You have executed 100 /me actions.");
Player[playerid][AchievementRank]++;
}
case 200: {
SendClientMessage(playerid, WHITE, "You have unlocked a new achievement!");
SendClientMessage(playerid, GREY, "You have executed 200 /me actions.");
Player[playerid][AchievementRank]++;
}
}
}
}
return 1;
}
command(do, playerid, params[])
{
new Message[128], string[128];
if(sscanf(params, "z", Message))
{
SendClientMessage(playerid, WHITE, "SYNTAX: /do [action]");
}
else
{
if(strlen(Message) < 1 || !IsPlayerConnectedEx(playerid))
{
return 1;
}
else
{
format(string, sizeof(string), "* %s ((%s)) ", Message, GetName(playerid));
NearByMessage(playerid, NICESKY, string);
}
}
return 1;
}
command(ooc, playerid, params[])
{
new Message[128], string[128];
if(sscanf(params, "z", Message))
{
SendClientMessage(playerid, WHITE, "SYNTAX: /o(oc) [message]");
}
else
{
if(Player[playerid][oMuted] >= 1)
{
SendClientMessage(playerid, WHITE, "You have been muted from the global OOC channel by an administrator.");
}
else
{
if(Player[playerid][AdminDuty] >= 1)
{
format(string, sizeof(string), "((Server Admin %s: %s)) ", GetName(playerid), Message);
SendClientMessageToAll(OOC_CHAT, string);
}
else if(oocenabled == 1 && Player[playerid][Authenticated] >= 1)
{
if(Player[playerid][VipRank] >= 1)
{
format(string, sizeof(string), "((VIP %s: %s)) ", GetName(playerid), Message);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i) && Player[i][ToggedOOC] == 0)
{
SendClientMessage(i, OOC_CHAT, string);
}
}
OOCChatLog(string);
}
else
{
if(Player[playerid][PlayingHours] < 1)
{
format(string, sizeof(string), "((%s %s: %s))", OOCRanks[Rank1], GetName(playerid), Message);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i) && Player[i][ToggedOOC] == 0)
{
SendClientMessage(i, OOC_CHAT, string);
}
}
}
else if(Player[playerid][PlayingHours] >= 1 && Player[playerid][PlayingHours] < 25)
{
format(string, sizeof(string), "((%s %s: %s))", OOCRanks[Rank2], GetName(playerid), Message);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i) && Player[i][ToggedOOC] == 0)
{
SendClientMessage(i, OOC_CHAT, string);
}
}
}
else if(Player[playerid][PlayingHours] >= 25 && Player[playerid][PlayingHours] < 100)
{
format(string, sizeof(string), "((%s %s: %s))", OOCRanks[Rank3], GetName(playerid), Message);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i) && Player[i][ToggedOOC] == 0)
{
SendClientMessage(i, OOC_CHAT, string);
}
}
}
else if(Player[playerid][PlayingHours] >= 100 && Player[playerid][PlayingHours] < 300)
{
format(string, sizeof(string), "((%s %s: %s))", OOCRanks[Rank4], GetName(playerid), Message);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i) && Player[i][ToggedOOC] == 0)
{
SendClientMessage(i, OOC_CHAT, string);
}
}
}
else if(Player[playerid][PlayingHours] >= 300)
{
format(string, sizeof(string), "((%s %s: %s))", OOCRanks[Rank5], GetName(playerid), Message);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i) && Player[i][ToggedOOC] == 0)
{
SendClientMessage(i, OOC_CHAT, string);
}
}
}
OOCChatLog(string);
}
}
else if(oocenabled == 0)
{
SendClientMessage(playerid, WHITE, "OOC channel is currently disabled.");
}
}
}
return 1;
}
command(pm, playerid, params[])
{
new string[128], message[128], id;
if(sscanf(params, "uz", id, message))
{
SendClientMessage(playerid, WHITE, "SYNTAX: /pm [playerid] [message]");
}
else
{
if(IsPlayerConnectedEx(id))
{
if(strlen(message) >= 1)
{
if(Player[id][PMsEnabled] == 1)
{
if(Player[id][AFKStat] == 1)
{
SendClientMessage(playerid, WHITE, "This administrator is away from keyboard, right now.");
}
else
{
format(string, sizeof(string), "((You have sent %s: %s)) ", GetName(id), message);
SendClientMessage(playerid, PLAYERCOM, string);
format(string, sizeof(string), "((PM from %s (ID: %d): %s)) ", GetName(playerid), playerid, message);
SendClientMessage(id, PLAYERCOM, string);
PMsLog(string);
}
}
else
{
SendClientMessage(playerid, WHITE, "That player has disabled PMs!");
}
}
else
{
SendClientMessage(playerid, WHITE, "SYNTAX: /pm [playerid] [message]");
}
}
else
{
SendClientMessage(playerid, WHITE, "That player is not connected or isn't logged in.");
}
}
return 1;
}
I can see a brackets that is out of place; It's under the first occurance of 'NearByMessage' in the code you posted.
pawn Код:
command(me, playerid, params[]) {
new
string[128]; // Updated this as I forgot about the whole params usage at the time of originally creating this.... but seeing as how noobs constantly rip this command I might as well give them some good code to rip from! (yes I'm talking about you, RealCop228 and all the others)
if(isnull(params)) {
return SendClientMessage(playerid, WHITE, "SYNTAX: /me [action]");
}
else {
if(Player[playerid][PrisonID] == 1) {
SendClientMessage(playerid, WHITE, "You're unable to do this right now!");
}
else {
format(string, sizeof(string), "* %s %s", GetName(playerid), params);
NearByMessage(playerid, NICESKY, string);
Player[playerid][MeActions]++;
switch(Player[playerid][MeActions]) {
case 100: {
SendClientMessage(playerid, WHITE, "You have unlocked a new achievement!");
SendClientMessage(playerid, GREY, "You have executed 100 /me actions.");
Player[playerid][AchievementRank]++;
}
case 200: {
SendClientMessage(playerid, WHITE, "You have unlocked a new achievement!");
SendClientMessage(playerid, GREY, "You have executed 200 /me actions.");
Player[playerid][AchievementRank]++;
}
}
}
return 1;
}
The only mistake I found was in /me command. Copy this, instead of what you have and it should work fine.
C:\Users\Mijn pc\Desktop\SERVER\Elite RolePlay\gamemodes\test.pwn(91) : error 017: undefined symbol "command"
C:\Users\Mijn pc\Desktop\SERVER\Elite RolePlay\gamemodes\test.pwn(95) : error 017: undefined symbol "isnull"
C:\Users\Mijn pc\Desktop\SERVER\Elite RolePlay\gamemodes\test.pwn(96) : error 017: undefined symbol "WHITE"
C:\Users\Mijn pc\Desktop\SERVER\Elite RolePlay\gamemodes\test.pwn(99) : error 017: undefined symbol "Player"
C:\Users\Mijn pc\Desktop\SERVER\Elite RolePlay\gamemodes\test.pwn(99) : warning 215: expression has no effect
C:\Users\Mijn pc\Desktop\SERVER\Elite RolePlay\gamemodes\test.pwn(99) : error 001: expected token: ";", but found "]"
C:\Users\Mijn pc\Desktop\SERVER\Elite RolePlay\gamemodes\test.pwn(99) : error 029: invalid expression, assumed zero
C:\Users\Mijn pc\Desktop\SERVER\Elite RolePlay\gamemodes\test.pwn(99) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase