Toilet system
#1

hey im making a simple toilet system
THATS WHAT I've made:
PHP код:
// INCLUDES
#include "a_samp"
#include "zcmd"
// DEFINES
#define COLOR_YELLOW 0xFFFF00FF
#define COLOR_GREEN 0x00FF00FF
#define COLOR_RED 0xFF0000FF
#define COLOR_BLUE 0x0000FFFF
new TimeToPee[MAX_PLAYERS];
new 
toilettimer;
new 
toilettimer2;
new 
peeing;
public 
OnPlayerConnect(playerid)
{
    
toilettimer SetTimerEx("toilettime",180000,false,"%d",playerid);
    return 
1;
}
forward toilettime(playerid);
public 
toilettime(playerid)
{
    
SendClientMessage(playerid,COLOR_BLUE,"Time to /pee ...you have 20 seconds");
    
toilettimer2 SetTimerEx("toilettime2",20000,false,"%d",playerid);
    
TimeToPee[playerid] = 1;
    return 
1;
 }
forward toilettime2(playerid);
public 
toilettime2(playerid)
{
    if (
IsPlayerInAnyVehicle(playerid) == 1)
    {
    
RemovePlayerFromVehicle(playerid);
    
SetPlayerSpecialAction(playerid68);
    
TogglePlayerControllable(playerid0);
    
SendClientMessage(playerid,COLOR_RED,"You are peeing");
    
peeing SetTimerEx("pee",10000,false,"%d",playerid);
    
toilettimer SetTimerEx("toilettime",180000,false,"%d",playerid);
    
TimeToPee[playerid] = 0;
    }else{
    
SetPlayerSpecialAction(playerid68);
    
TogglePlayerControllable(playerid0);
    
peeing SetTimerEx("pee",10000,false,"%d",playerid);
    
toilettimer SetTimerEx("toilettime",180000,false,"%d",playerid);
    
SendClientMessage(playerid,COLOR_RED,"You are peeing");
    
TimeToPee[playerid] = 0;
    }
    return 
1;
}
forward pee(playerid);
public 
pee(playerid)
{
    
SendClientMessage(playerid,COLOR_BLUE,"You are done");
    
TogglePlayerControllable(playerid1);
    return 
1;
}
COMMAND:pee(playerid,params[])
{
    if (
TimeToPee[playerid] == 1)
    {
    
SetPlayerSpecialAction(playerid68);
    
toilettimer SetTimerEx("toilettime",180000,false,"%d",playerid);
    
peeing SetTimerEx("pee",10000,false,"%d",playerid);
    
TimeToPee[playerid] = 0;
    }else{
    
SendClientMessage(playerid,COLOR_RED,"It's not time to pee yet");
    }
    return 
1;
}
public 
OnPlayerDisconnect(playerid)
{
    
KillTimer(toilettimer);
    
KillTimer(toilettimer2);
    
KillTimer(peeing);

But after 3 minutes nothing happen....please help
Reply
#2

So Cool :X Great job ! 5/5
Reply
#3

It looks great from my side of view, but I can't really understand the problem.
Reply
#4

new toilettimer[MAX_PLAYERS];
new toilettimer2[MAX_PLAYERS];

tried that?
Reply
#5

Quote:
Originally Posted by RobinOwnz
Посмотреть сообщение
new toilettimer[MAX_PLAYERS];
new toilettimer2[MAX_PLAYERS];

tried that?
PHP код:
C:\Documents and Settings\scry\Desktop\Truck srv\filterscripts\toilet.pwn(16) : error 033: array must be indexed (variable "toilettimer")
C:\Documents and Settings\scry\Desktop\Truck srv\filterscripts\toilet.pwn(23) : error 033: array must be indexed (variable "toilettimer2")
C:\Documents and Settings\scry\Desktop\Truck srv\filterscripts\toilet.pwn(37) : error 033: array must be indexed (variable "toilettimer")
C:\Documents and Settings\scry\Desktop\Truck srv\filterscripts\toilet.pwn(43) : error 033: array must be indexed (variable "toilettimer")
C:\Documents and Settings\scry\Desktop\Truck srv\filterscripts\toilet.pwn(61) : error 033: array must be indexed (variable "toilettimer")
C:\Documents and Settings\scry\Desktop\Truck srv\filterscripts\toilet.pwn(72) : error 035argument type mismatch (argument 1)
C:\Documents and Settings\scry\Desktop\Truck srv\filterscripts\toilet.pwn(73) : error 035argument type mismatch (argument 1)
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
7 Errors

Reply
#6

Anyone got idea wuts wrong?
Reply
#7

Since you assigned "toilettimer" to an array, you can't do: "toilettimer = ...". An example would be:
pawn Код:
public OnPlayerConnect(playerid)
{
    toilettimer[ playerid ] = SetTimerEx( "toilettime", 180000, false, "d", playerid );
    return 1;
}
Reply
#8

Index this, wher you see the errors.

if:
new toilettimer[MAX_PLAYERS];
new toilettimer2[MAX_PLAYERS];

When you use toilettimer for player, do it like this: toilettimer[playerid]
Reply
#9

Doesnt works :S
Reply
#10

Most probably, it's got something to do with your SetTimerEx:
pawn Код:
SetTimerEx("toilettime",180000,false,"%d",playerid);
Unlike format( ), you don't use the % symbol. That gives you:
pawn Код:
SetTimerEx("toilettime",180000,false,"d",playerid);
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)