/rape bugged
#1

When i type for example /rape 2 it rapes id 0 only! what is the problem?:S

pawn Код:
if(strcmp(cmd, "/rape", true) == 0) {
    if(IsSpawned[playerid] == 0) {
    SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
    return 1;
    }
    if(cuffed[playerid] == 1) {
    SendClientMessage(playerid,COLOR_ERROR,"You are handcuffed. 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_COP) {
    SendClientMessage(playerid,COLOR_ERROR,"Law Enforcement agents cannot rape people");
    return 1;
    }
    if(gTeam[playerid] == TEAM_ARMY) {
    SendClientMessage(playerid,COLOR_ERROR,"Law Enforcement agents cannot rape people");
    return 1;
    }
    if(gTeam[playerid] == TEAM_CASSEC) {
    SendClientMessage(playerid,COLOR_ERROR,"Casino Security agents cannot rape people");
    return 1;
    }
    if(gTeam[playerid] == TEAM_MEDIC) {
    SendClientMessage(playerid,COLOR_ERROR,"Medics cannot rape people");
    return 1;
    }
    if(gTeam[playerid] == TEAM_JAILTK) {
    SendClientMessage(playerid,COLOR_ERROR,"Jail Turnkeys cannot rape people");
    return 1;
    }
    if(RapedPlyRecent[playerid] == 1) {
    SendClientMessage(playerid,COLOR_ERROR,"Command used recently... Please wait");
    return 1;
    }
    if(InBank[playerid] == 1) {
    SendClientMessage(playerid, COLOR_ERROR, "You cannot rape a player inside the bank");
    return 1;
    }
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) {
    SendClientMessage(playerid, COLOR_ERROR, "USAGE: /rape (id)");
    return 1;
    }
    if(!IsNumeric(tmp)) {
    SendClientMessage(playerid, COLOR_ERROR, "USAGE: /rape (id) ID Must be a number");
    return 1;
    }
    if(strval(tmp) == playerid) {
    SendClientMessage(playerid, COLOR_ERROR, "You cannot rape yourself");
    return 1;
    }

    new rapername[24];
    new victimname[24];
    GetPlayerName(playerid,rapername, 24);
    GetPlayerName(giveplayerid, victimname, 24);

    if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 2) {
    format(string, sizeof(string), "%s[%d] Is not close enough. You cannot rape that player",victimname,giveplayerid);
    SendClientMessage(playerid, COLOR_ERROR, string);
    return 1;
    }
    if(Jailed[giveplayerid] == 1) {
    format(string, sizeof(string), "%s[%d] Is in jail. You cannot rape a prisoner",victimname,giveplayerid);
    SendClientMessage(playerid, COLOR_ERROR, string);
    return 1;
    }
    if(cuffed[giveplayerid] == 1) {
    format(string, sizeof(string), "%s[%d] Is handcuffed. You cannot rob a player who is handcuffed",victimname,giveplayerid);
    SendClientMessage(playerid, COLOR_ERROR, string);
    return 1;
    }
    if(IsPlayerInAnyVehicle(giveplayerid)) {
    format(string, sizeof(string), "%s[%d] Is in a vehicle. You cannot rape that player",victimname,giveplayerid);
    SendClientMessage(playerid, COLOR_ERROR, string);
    return 1;
    }
    new Float:victimhealth;
    GetPlayerHealth(giveplayerid,victimhealth);
    if(IsSpawned[giveplayerid] == 0) {
    new plwl = GetPlayerWantedLevel(playerid);
    new pcol = GetPlayerColor(playerid);
    SetPlayerWantedLevel(playerid,plwl +1);
    format(string, sizeof(string), "%s[%d] Has raped %s[%d]'s dead, rotting corpse",rapername,playerid,victimname,giveplayerid);
    SendClientMessageToAll(0xB22222AA, string);
    ircSay(EchoConnection, EchoChan,string);
    SpamStrings[playerid] ++;
    if(Chlamydia[playerid] == 0) {
    format(string, sizeof(string), "%s[%d] Has been infected with Chlamydia",rapername,playerid);
    SendClientMessageToAll(0x00C7FFAA, string);
    Chlamydia[playerid] =1;
    }
    SendClientMessage(playerid, 0xA9A9A9AA, "|_Rape Complete_|");
    format(string, sizeof(string), "You have raped %s[%d]'s dead body", victimname,giveplayerid);
    SendClientMessage(playerid,0x00C7FFAA,string);
    plwl = GetPlayerWantedLevel(playerid);
    SendClientMessage(playerid, 0xA9A9A9AA, "|_Crime Commited_|");
    format(string, sizeof(string), "(CORPSE RAPE) Wanted Level %d",plwl);
    SendClientMessage(playerid,pcol,string);
    return 1;
    }
    if(gTeam[playerid] == TEAM_RAPIST && victimhealth <=25) {
    SetPlayerHealth(giveplayerid,0);
    oscore = GetPlayerScore(playerid);
    SetPlayerScore(playerid, oscore +1);
    format(string, sizeof(string), "%s[%d] Has been raped to death by rapist %s[%d]",victimname,giveplayerid,rapername,playerid);
    SendClientMessageToAll(0xB22222AA, string);
    ircSay(EchoConnection, EchoChan,string);
    new plwl = GetPlayerWantedLevel(playerid);
    new pcol = GetPlayerColor(playerid);
    SetPlayerWantedLevel(playerid,plwl +10);
    plwl = GetPlayerWantedLevel(playerid);
    SendClientMessage(playerid, 0xA9A9A9AA, "|_Crime Commited_|");
    format(string, sizeof(string), "(MURDER) Wanted Level %d",plwl);
    SendClientMessage(playerid,pcol,string);
    format(string, sizeof(string), "~h~~r~RAPED TO DEATH BY~n~~h~~w~%s[%d]",rapername,playerid);
    GameTextForPlayer(giveplayerid,string,5000,3);
    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: (MURDER) Suspect: %s[%d] has murdered %s[%d] Location: %s",rapername,playerid,victimname,giveplayerid,zones[current_zone][zone_name]);
    SendClientMessage(i,COLOR_ROYALBLUE,string);
    SendClientMessage(i,COLOR_ROYALBLUE,"DISPATCH: All units in the area respond");
    }
    }
    return 1;
    }

    if(gTeam[playerid] == TEAM_RAPIST) {
    new Float:phealth;
    GetPlayerHealth(giveplayerid,phealth);
    SetPlayerHealth(giveplayerid, phealth-10);
    GetPlayerHealth(playerid,phealth);
    SetPlayerHealth(playerid, phealth+10);
    oscore = GetPlayerScore(playerid);
    SetPlayerScore(playerid, oscore +1);
    Chlamydia[giveplayerid] =1;
    format(string, sizeof(string), "%s[%d] Has been infected with Chlamydia",victimname,giveplayerid);
    SendClientMessageToAll(0x00C7FFAA, string);
    ircSay(EchoConnection, EchoChan,string);
    }
    if(gTeam[playerid] != TEAM_RAPIST && Chlamydia[playerid] == 1) {
    Chlamydia[giveplayerid] =1;
    format(string, sizeof(string), "%s[%d] Has been infected with Chlamydia",victimname,giveplayerid);
    SendClientMessageToAll(0x00C7FFAA, string);
    ircSay(EchoConnection, EchoChan,string);
    format(string, sizeof(string), "You have infected %s[%d] with Chlamydia",victimname,giveplayerid);
    SendClientMessage(playerid,0x00C7FFAA, string);
    }
    SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Rape Victim_|");
    format(string, sizeof(string), "%s[%d] Has raped you",rapername,playerid);
    SendClientMessage(giveplayerid, 0xD2691EAA, string);
    SendClientMessage(playerid, 0xA9A9A9AA, "|_Rape Complete_|");
    format(string, sizeof(string), "You have raped %s[%d]", victimname,giveplayerid);
    SendClientMessage(playerid, 0x00C7FFAA, string);
    RapedPlyRecent[playerid] =1;
    format(string, sizeof(string), "%s[%d] Has raped %s[%d]",rapername,playerid,victimname,giveplayerid);
    printf("%s", string);
    ircSay(EchoConnection, EchoChan,string);
    PlayerPlaySound(giveplayerid, 1190, 0.0, 0.0, 0.0);
    commitedcrimerecently[playerid] +=120;
    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: (RAPE) Suspect: %s[%d] has raped %s[%d] Location: %s",rapername,playerid,victimname,giveplayerid,zones[current_zone][zone_name]);
    SendClientMessage(i,COLOR_ROYALBLUE,string);
    }
    }
    if(gTeam[giveplayerid] == TEAM_COP || gTeam[giveplayerid] == TEAM_ARMY) {
    new plwl = GetPlayerWantedLevel(playerid);
    SetPlayerWantedLevel(playerid, plwl +4 );
    }
    else{
    new plwl = GetPlayerWantedLevel(playerid);
    SetPlayerWantedLevel(playerid, plwl +2 );
    }
    new pcol = GetPlayerColor(playerid);
    new plwl = GetPlayerWantedLevel(playerid);
    SendClientMessage(playerid, 0xA9A9A9AA, "|_Crime Commited_|");
    format(string, sizeof(string), "(RAPE) Wanted Level %d",plwl);
    SendClientMessage(playerid,pcol,string);


    return 1;
    }
Reply
#2

fix the [pawn] tag
Reply
#3

Didnt' notice!
Sorry,done!
Reply
#4

You should consider switching to zcmd/sscanf....
Reply
#5

yea maybe but i need to fix this bug first
Reply
#6

BUMP!
Reply
#7

wait i'm going to fix it
Reply
#8

tmp = strtok(cmdtext, idx); must be tmp = strtok(cmd, idx);
meaby that will fix it (under the "cannot rape in bank" error
Reply
#9

giveplayerid is not assigned here any value ;x
giveplayerid = strval(tmp)?
And leave tmp = strtok(cmdtext,idx) cuz that's good.
Reply
#10

Not a PG command at all, huh?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)