04.02.2009, 18:16
C:\DOCUME~1\17FE8~1.MRK\SKRIVB~1\serv\pawno\test.p wn(3713) : warning 209: function "OnPlayerCommandsText" should return a value
return 1;
}
}
}
}
} < 3713
return 1;
}
}
}
}
} < 3713
|
Originally Posted by SuperS0nic
C:\DOCUME~1\17FE8~1.MRK\SKRIVB~1\serv\pawno\test.p wn(3713) : warning 209: function "OnPlayerCommandsText" should return a value
return 1; } } } } } < 3713 |
if(strcmp(cmd, "/911", true) == 0) {
if(IsSpawned[playerid] == 0) {
SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
return 1;
}
if(Jailed[playerid] ==1) {
SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in jail");
return 1;
}
if(InDerby[playerid] == 1) {
SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command while you are in the stadium");
return 1;
}
if(gTeam[playerid] <= 2) {
SendClientMessage(playerid,COLOR_ERROR,"You are a Law Enforcement officer. You cannot call /911 ");
return 1;
}
if (!GetPlayersInTeam(TEAM_COPS)) {
SendClientMessage(playerid,COLOR_ERROR,"There are no Police officers in the area");
return 1;
}
new output[70];
strmid(output,cmdtext,5,strlen(cmdtext));
if(strlen(cmdtext) <= 4) {
SendClientMessage(playerid, 0xA9A9A9AA, "USAGE: /911 (message)");
return 1;
}
SendClientMessage(playerid, 0xA9A9A9AA, "|_Dialed 911_|");
SendClientMessage(playerid,0x00C7FFAA,"You have dialed 911 - Please wait for Police assistance");
new callername[30];
GetPlayerName(playerid,callername, 30);
new current_zone;
current_zone = player_zone[playerid];
for(new i=0;i<MAX_PLAYERS;i++)
{
if(LawEnforcementRadio[i] == 1) {
format(string, sizeof(string), "DISPATCH: (911) %s(%d) has called 911",callername,playerid);
SendClientMessage(i,COLOR_ROYALBLUE,string);
format(string, sizeof(string), "%s(%d) Said: ( %s )",callername,playerid,output);
SendClientMessage(i,COLOR_ROYALBLUE,string);
format(string, sizeof(string), "All units in the area please respond. Location: %s",zones[current_zone][zone_name]);
SendClientMessage(i,COLOR_ROYALBLUE,string);
return 1;
}
}
}
}
}
new string[256];
public OnPlayerCommandsText(playerid, cmdtext[])
{
new string[256];
new cmd[256];
new giveplayerid, idx;
new tmp[256];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/heal", true) == 0) {
if(IsSpawned[playerid] == 0) {
SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
return 1;
}
if(Jailed[playerid] == 1) {
SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in jail");
return 1;
}
if(gTeam[playerid] != TEAM_MEDIC) {
SendClientMessage(playerid,COLOR_ERROR,"You are not a medic");
return 1;
}
if(InDerby[playerid] == 1) {
SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command while you are in the stadium");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /heal (id)");
return 1;
}
giveplayerid = strval(tmp);
if(!IsNumeric(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /heal (id) ID Must be a number");
return 1;
}
new mname[24];
new pname[24];
GetPlayerName(playerid,mname, 24);
GetPlayerName(giveplayerid, pname, 24);
if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 5) {
format(string, sizeof(string), "%s(%d) Is not close enough. You cannot heal that player",pname,giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
if(wantsheal[giveplayerid] == 0) {
format(string, sizeof(string), "Medic %s(%d) has attempted to heal you. Type /medic if you need a Medic",mname,playerid);
SendClientMessage(giveplayerid,COLOR_FORESTGREEN, string);
format(string, sizeof(string), "%s(%d) has not asked for a medic. You cannot heal that player", pname,giveplayerid);
SendClientMessage(playerid,COLOR_ERROR, string);
}
else
if(wantsheal[giveplayerid] == 1) {
new mrand = random(3500);
oscore = GetPlayerScore(playerid);
SendClientMessage(giveplayerid,0xA9A9A9AA, "|_Health Restored_|");
format(string, sizeof(string), "Medic %s(%d) has healed you for $%d",mname,playerid,mrand);
SendClientMessage(giveplayerid,COLOR_FORESTGREEN, string);
SendClientMessage(playerid,0xA9A9A9AA, "|_Player Health Restored_|");
format(string, sizeof(string), "%s(%d) has been healed. You earned $%d", pname,giveplayerid,mrand);
SendClientMessage(playerid,COLOR_FORESTGREEN, string);
SetPlayerHealth(giveplayerid,100);
GivePlayerMoney(giveplayerid,-mrand);
GivePlayerMoney(playerid,mrand);
SetPlayerScore(playerid, oscore +1);
wantsheal[giveplayerid] =0;
}
return 1;
}
|
Originally Posted by 0rb
Read pawn doc
|
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmd, "/911", true) == 0)
{
if(IsSpawned[playerid] == 0)
{
SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
return 1;
}
if(Jailed[playerid] ==1)
{
SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in jail");
return 1;
}
if(InDerby[playerid] == 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command while you are in the stadium");
return 1;
}
if(gTeam[playerid] <= 2)
{
SendClientMessage(playerid,COLOR_ERROR,"You are a Law Enforcement officer. You cannot call /911 ");
return 1;
}
if (!GetPlayersInTeam(TEAM_COPS))
{
SendClientMessage(playerid,COLOR_ERROR,"There are no Police officers in the area");
return 1;
}
new output[70];
strmid(output,cmdtext,5,strlen(cmdtext));
if(strlen(cmdtext) <= 4)
{
SendClientMessage(playerid, 0xA9A9A9AA, "USAGE: /911 (message)");
return 1;
}
SendClientMessage(playerid, 0xA9A9A9AA, "|_Dialed 911_|");
SendClientMessage(playerid,0x00C7FFAA,"You have dialed 911 - Please wait for Police assistance");
new callername[30];
GetPlayerName(playerid,callername, 30);
new current_zone;
current_zone = player_zone[playerid];
for(new i=0;i<MAX_PLAYERS;i++)
{
if(LawEnforcementRadio[i] == 1)
{
format(string, sizeof(string), "DISPATCH: (911) %s(%d) has called 911",callername,playerid);
SendClientMessage(i,COLOR_ROYALBLUE,string);
format(string, sizeof(string), "%s(%d) Said: ( %s )",callername,playerid,output);
SendClientMessage(i,COLOR_ROYALBLUE,string);
format(string, sizeof(string), "All units in the area please respond. Location: %s",zones[current_zone][zone_name]);
SendClientMessage(i,COLOR_ROYALBLUE,string);
return 1;
}
}
}
return 0;
}